Define a mask

A mask names the bits you want to work with. For a simple unsigned flags variable, a one in position three can be written as 1u << 3. Giving that mask a name keeps the intent visible.

const uint32_t ready_mask = 1u << 3;
flags |= ready_mask;   // Set the bit.
flags &= ~ready_mask;  // Clear the bit.
flags ^= ready_mask;   // Toggle the bit.

Test the bit

To test it, use (flags & ready_mask) != 0. These examples operate on an ordinary variable. Hardware registers can have special read and write behavior, so check the register documentation before applying the same operations to a peripheral.