Bit Manipulation & Integer Arithmetic
Interactive tool for exploring bit operations and arithmetic across different integer types.
Configuration & Current Value
Range: -128 to 127
Big Endian (Most Significant Byte First)
Byte 0
7
6
5
4
3
2
1
0
Sign bit
Little Endian (Least Significant Byte First)
Byte 0
7
6
5
4
3
2
1
0
Sign bit
Click any bit to toggle | Big Endian: MSB first (Byte 0 = highest bits) | Little Endian: LSB first (Byte 0 = lowest bits)
Arithmetic Operations
Bit Shift Operations
Shifting signed values is bad for your health. Switch to unsigned mode for safe shifting.
Understanding Bit Operations
Signed vs Unsigned
- Unsigned: All bits represent magnitude (0 to 2^n-1)
- Signed: MSB is sign bit (two's complement, -2^(n-1) to 2^(n-1)-1)
Shift Operations (C/C++)
- Left Shift (<<): Shifts bits left, fills with zeros (multiplies by 2^n)
- Right Shift (>>): Shifts bits right, fills with zeros (divides by 2^n)
- Note: Shift operations are only shown for unsigned integers due to the complexity and implementation-defined behavior of signed shifting in C/C++