in reply to Re: Bitwise and operator question
in thread Bitwise and operator question

A little more of explanation: Realize the following decimal to binary correspondence:

128 = 10000000 64 = 01000000 32 = 00100000 16 = 00010000 8 = 00001000 4 = 00000100 2 = 00000010 1 = 00000001

A binary AND (&) compares bit to bit 2 numbers. If you have the number 123 (in binary: 01111011):

123 & 128 = 01111011 (123) & 10000000 (128) ----------- 00000000 (0) = 0 123 & 64 01111011 (123) & 01000000 (64) ----------- 01000000 (64) = 64 123 & 32 01111011 (123) & 00100000 (32) ----------- 00100000 (32) = 32 And so on...

Hope this helps to clarify the script

citromatik

Replies are listed 'Best First'.
Re^3: Bitwise and operator question
by Severy (Initiate) on Aug 09, 2007 at 15:26 UTC
    it does.. thank you very much!