>Assembly
How does the AND (&) operation work on 16 bit numbers? Is it equivalents to add if its not a logical operarator (&&)
Hi Ugly God
>>58972614
AND basically sets the bits common to both numbers and clears the rest.
eg10110010
01011010
--------- AND
00010010
Some common uses, taking the lower 4 bits from a number:10110110
00001111
--------- AND
00000110
Make a number even (rounding towards 0):10110101
11111110
--------- AND
10110100
>>58972614
>What's Google?
It's a bit operator. Bitwise and.
11110000 & 10101010 = 10100000.
The numbers being 16bit doesn't change anything.
It ANDs each bit:
1001 & 1100 == 1000
Basic math that you could have googled.
>>58972614
ANDing with 0 is used to clear bits
ORing with 1 is used to set bits
XORing with 1 is used to flip bits
>>58972788
>>58972794
see I thought that but on a test review, he has:
>0x9057 & 0x2F2A
>Result = 0x0002
>>589728401001000001010111 (0x9057)
0010111100101010 (0x2f2a)
----------------- AND
0000000000000010 (0x0002)
Only the second bit is common to both numbers, so the answer is 2
>>58972887
I am sorry
thread is over