Change the decimal to binary

For example change the number 40 into binary number

Power of two closest to 40 is 32 plus 8,
32 = 2 ^ 5
8 = 2 ^ 3
So on the order of 5 and 2 1 rated

7 6 5 4 3 2 1 0 ~ 1 byte = 8 bits
-----
0 0 1 0 1 0 0 0

So the number 40 in binary is 0 0 1 0 1 0 0 0

Change the binary number to decimal

Change 0 0 1 0 1 0 0 0 to decimals

7 6 5 4 3 2 1 0
-----
0 0 1 0 1 0 0 0

In the fifth and third order valued at 1, so
(2 ^ 5) + (2 ^ 3) = 32 +8 = 40

OR Operation

If there is one that is worth 1, the result is a
Example: 40 OR 7

7 6 5 4 3 2 1 0
-----
0 0 1 0 1 0 0 0
0 0 0 0 0 1 1 1
-----
0 0 1 0 1 1 1 1 = 47

XOR Operation

If there is one that is worth 1, the result is one, if both are worth one or 0 then the result is 0
Example: 40 XOR 8

7 6 5 4 3 2 1 0
-----
1 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
-----
0 0 1 0 0 0 0 0 = 32

INTERNATIONAL Operations

If both a valuable one, the result is a
Example: 40 AND 8

7 6 5 4 3 2 1 0
-----
0 0 1 0 1 0 0 0
0 0 0 0 1 0 0 0
-----
0 0 0 0 1 0 0 0 = 8

NOT operation

Contrary to the previous value
Example: NOT 20

Seven six 5 4 3 2 1 0
-----
0 0 0 1 0 1 0 0
-----
1 1 1 0 1 0 1 1 = 235

No write dewe!
Comments always welcome ...

Possibly Related Posts:


Posted by Fuad under Pascal