Decode or encode a signed integer as a fixed-width two’s-complement bit pattern.
For width w, the signed interval is −2^(w−1) through 2^(w−1)−1. Decimal input is reduced modulo 2^w and decoded by subtracting 2^w when the top bit is set; binary input reverses that interpretation and is padded to the selected width.
Value: -5 Bit width: 8 Direction: decimalToBinary
Requested value: -5 Stored value: -5 Binary pattern: 11111011 Hex pattern: fb Bit width: 8 Min value: -128 Max value: 127 Overflow: no Overflow message:
Systems lessons decode signed bytes, compiler exercises inspect register widths, and protocol debugging compares binary and hexadecimal fields.