Date: Sat, 12 Jul 1997 14:28:56 -0700 (PDT) Message-Id: <199707122128.OAA11763@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: "Liam" From: Nate Eldredge Subject: Re: odd or even # of 1's (was: no subject) Cc: djgpp AT delorie DOT com Precedence: bulk At 03:35 7/12/1997 +0100, you wrote: >To find out if a value is odd or even all you have to do is check the first >bit, bit 0. That wasn't the question. The original poster wanted to find whether there were an odd or even number of *1 bits* in an int (wanted to know its parity). Ie, this number: 01110001010111001101010111001010b has 17 1-bits in its binary representation, hence it has odd parity. Even though it is an even number. Nate Eldredge eldredge AT ap DOT net