embeddedtoolkitBETA
BITWISE / REGISTER TOOLS

Bit ManipulatorUnsigned register operations

Operate on the exact bits. See the result. Copy the C.

Unsigned values: decimal, or 0x / 0b / 0o prefixes. Bits are numbered from zero. Mask endpoints are inclusive.

Examples:

Result

Unsigned
Signed (two’s complement)

Operand A · click to toggle a bit

Result bits are read-only. Operand A is not used when generating a mask.

Generated C code

REGISTER SEMANTICS

An unsigned workbench.

Inputs must fit the selected width. NOT is width-limited. Shift Left drops high bits beyond that width; Shift Right fills with zeros. Shift counts must be 0 through width − 1. Read Bit returns 0 or 1. Mask uses a start and end bit, both inclusive.

Example: 8-bit 0xA5 AND 0x0F = 0x05; NOT 0xA5 = 0x5A. Signed output is an interpretation of the result, not signed arithmetic.

C / INTEGER PROMOTIONS

Shifts that stay defined.

C promotes small integer types before shifting. The generated function uses uintmax_t before any operation, applies an explicit width mask, and casts to uintN_t at the end. It never shifts by the register width or uses signed right shift. Full-width masks are constants, avoiding 1 << 64.

Requires C99+ and the exact-width types from <stdint.h>. The selected fixed-width behavior is intentional; it does not simulate every target compiler’s signed rules.

C11 draft · §6.3.1.1 / §6.5.7

Continue in another tool

Transfers the current unsigned value and width to a new same-origin tab through memory only. SPI sends the first TX frame, zero-extended to 8/16/32 bits, and accepts up to 32 bits. No values are added to URLs or saved.

Related tools (open without a value)