Bit mask

Applies to: c, cpp, embedded

A bit mask isolates or changes selected bits using operations such as AND, OR, and NOT.

flags |= (1u << 3);
if (flags & (1u << 3)) {}

See also: bit-shift, register