Worked example

Operation: AND
a: 12
b: 10
Bit width: 8
Interpretation: Unsigned
12 = 0000 1100₂
10 = 0000 1010₂
1100 ∧ 1010 = 1000₂ = 8

→ 0000 1000; hex: 08; 10: 8

Method and scope

Enter decimal integers within the selected signed or unsigned range. Widths: 8, 16, 32, 64. Results are masked to the chosen width; left-shift overflow bits are discarded. Shift count b must be 0≤b<width. Arithmetic right shift repeats the high sign bit.

mask = 2ʷ − 1; result = operation & mask