Boolean Algebra - A little help please...

Associate
Joined
21 Nov 2006
Posts
716
Location
Dublin
ok so we're given an example of " 0xAA && 0x12 = 0x01 ". This I worked out and got the same, all good.

Next example is " !0xAA && 0x12 = 0x00 ". Now I worked this out to be 0x01 :confused:

Code:
0xAA = 10101010;
!0xAA = 01010101;

0x12 = 00010010;

so    01010101
      00010010 &&
      00010000

which would be 0x01 :confused:

Am I going wrong somewhere or is the example wrong?
 
This is the way it's shown:

IMG_20110303_130458.jpg
 
OK, then those are 'C' style operators. You don't work in a bitwise fashion.

As far as your bitwise calculation of 0xAA & 0x12: your final answer is 2 (00000010), not 1 (00000001).

It says the && are logical operators. "For logical operators any non zero value is considered 1." That's why I got 1, not 2.
 
Ok just found something I had written in the note. "Logical. Don't convert to binary". So do it evilpauls way? Must remember to look through my notes :o
 
Back
Top Bottom