File syn_bits.h¶
FileList > src > syntropic > util > syn_bits.h
Go to the source code of this file
Bit manipulation macros. More...
#include <stdint.h>
Macros¶
| Type | Name |
|---|---|
| define | SYN_BIT (n) ((uint32\_t)1U << (n)) |
| define | SYN_BITMASK (width, offset) (((1U << (width)) - 1U) << (offset)) |
| define | SYN_BITS_GET (reg, width, offset) (((reg) >> (offset)) & ((1U << (width)) - 1U)) |
| define | SYN_BITS_SET (reg, width, offset, value) /* multi line expression */ |
| define | SYN_BITS_TO_BYTES (bits) (((bits) + 7U) / 8U) |
| define | SYN_BIT_CHECK (reg, bit) ((reg) & [**SYN\_BIT**](syn__bits_8h.md#define-syn_bit)(bit)) |
| define | SYN_BIT_CLEAR (reg, bit) ((reg) &= ~[**SYN\_BIT**](syn__bits_8h.md#define-syn_bit)(bit)) |
| define | SYN_BIT_SET (reg, bit) ((reg) \|= [**SYN\_BIT**](syn__bits_8h.md#define-syn_bit)(bit)) |
| define | SYN_BIT_TOGGLE (reg, bit) ((reg) ^= [**SYN\_BIT**](syn__bits_8h.md#define-syn_bit)(bit)) |
Detailed Description¶
All macros are pure preprocessor — zero overhead, no function calls.
Macro Definition Documentation¶
define SYN_BIT¶
Produce a bitmask with bit n set (0-indexed).
define SYN_BITMASK¶
Produce a bitmask of width bits starting at bit position offset. Example: SYN_BITMASK(3, 4) → 0b0000'0000'0111'0000 → 0x70
define SYN_BITS_GET¶
Extract a bit-field of width bits starting at offset from reg.
define SYN_BITS_SET¶
Set a bit-field: clear the field in reg, then OR in value.
define SYN_BITS_TO_BYTES¶
Number of bytes needed to store bits.
define SYN_BIT_CHECK¶
Check if bit bit is set in reg. Evaluates to non-zero if set.
define SYN_BIT_CLEAR¶
Clear bit bit in register/variable reg.
define SYN_BIT_SET¶
Set bit bit in register/variable reg.
define SYN_BIT_TOGGLE¶
Toggle bit bit in register/variable reg.
The documentation for this class was generated from the following file src/syntropic/util/syn_bits.h