C CASTLE / MODULE NOTES
CASTLE/Modules/Bit

MODULE 02 / 15

Bit

An umbrella header for Castle bit-manipulation components, from masks and rotations to flags.

#include "castle/bit/bit.hpp"

Overview

Umbrella header that pulls in every Castle bit-manipulation component. Use it when one translation unit needs several bit helpers and a single include is more convenient than selecting individual headers.

Dependencies

  • bit_core
  • bit_count
  • bit_mask
  • bit_math
  • bit_reverse
  • bit_rotate
  • bit_utils
  • flags

Public API

SignatureDescription
#include "castle/bit/bit.hpp"Includes the complete public API from the eight bit component headers listed above. No additional declarations are introduced by this umbrella header.

Usage example

See samples/sample_bit.cpp for a complete example.

#include "castle/bit/bit.hpp"

uint8_t value = 0;
value = castle::bit::set(value, 3U);
const uint8_t rotated = castle::bit::rotate_left(value, 1U);
castle::bit::flags<uint8_t, 0x0FU> status(rotated);

Constraints & notes

  • Header-only and allocation-free.
  • Behavior comes entirely from the included component headers.
  • Prefer the narrower component header when include surface matters more than convenience.