I'm wondering how I would be able to tell if an integer is even or odd, I know that if the least significant bit is 1 then it is odd but I don't know how to tell if the integer has this bit as a 1 or a 0.

Re: odd or ever 80 80

Look at the bit-wise operations like "AND", "OR" and "XOR".

Re: odd or ever 80 80

Pentium class processor also have BT (Bit Test) that is non destructive unlike Salem's examples.

bt      eax, 0

would test bit zero and return CY = 1 if set otherwise 0. Otherwise boolean operators like in the previous post are the best alternative or choice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.