Binary Encoding
Stores nonnegative integers as binary numbers in n bits, padded with leading zeros.
Configure your inputs and press Compute to see the step-by-step computation.
How it works
Binary encoding c2,n is the simplest n-bit encoding. It stores the binary representation of a number x with 0 <= x <= 2n - 1, padded with leading zeros to length n. With n = 8 the representable range is 0 to 255. Addition is performed digit by digit with carry; a bit overflow is dropped via modulo 2n.
When to use
In C this corresponds to the unsigned datatypes (unsigned char, unsigned int). Useful when negative values are excluded (indices, sizes, bit fields, low-level programming).