- 2
why do we need bitwise operation such as XOR
bitwise
2 Réponses
0
bitwise operators operate at bit level on whole numbers: they are the fastest operations to be done on whole numbers...
xor operator works as:
1 xor 1 = 0
1 xor 0 = 1
0 xor 1 = 1
0 xor 0 = 0
so xor is used as a mask wich invert bits where bit is set and leave bits unchanged where bit is not set...
at a very low level, all instructions are done using combined/chained bitwise operators (each is a specialized electronic transistor wich compound nowadays microprocessors by more of 10 billions)