How to calculate
Invert each bit and add one, keeping only the selected fixed-width bits. Decode a negative word by subtracting the fixed-width modulus or mask as appropriate.
Worked example
Use Operation Encode signed decimal · Signed decimal or binary word -5 · Word width 8 bits. The result is 11111011.
Input and result notes
Short binary words are padded with zeros on the left. Enter a full-width word to specify a negative bit pattern.
MIT two’s complement and bitwise shifts