How to calculate
Invert every bit and preserve the two signed encodings of zero. 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 11111010.
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