Results
Result (unsigned)
How it works
A AND B · A OR B · A XOR B · NOT A · A << n · A >> nBitwise operations work on each bit position separately. AND gives 1 only where both bits are 1 (handy for masking), OR where either is 1 (setting flags), XOR where they differ (toggling). Shifting left by n multiplies by 2ⁿ, shifting right divides. With a fixed width, the top bit can mean a sign: in two’s complement 1111 1111 is −1 as a signed 8-bit number and 255 unsigned. Negative inputs are stored that way.
-
Bit by bit
A 1100 1010 B 0011 1100 AND 0000 1000 -
Printed from rocketcalc.io/computing/bitwise