|
cbase 1.46.11
C/C++ Static Template
|
Fast, bitwise macros for aligning pointers and sizes to powers of 2. More...
Macros | |
| #define | ALIGN_UP_POW2(x, p) |
| Aligns a value UP to the nearest power of 2. | |
| #define | ALIGN_DOWN_POW2(x, p) |
| Aligns a value DOWN to the nearest power of 2. | |
| #define | IS_POW2_OR_ZERO(x) |
| Checks if a given integer is a power of 2 (or zero). | |
| #define | SHIFT8(T, x, s) |
| Shifts a byte value to a specific bit position. | |
| #define | PACK_U32_LE(a, b, c, d) |
| Packs 4 bytes into a 32-bit unsigned integer (little-endian order). | |
Fast, bitwise macros for aligning pointers and sizes to powers of 2.
| #define ALIGN_DOWN_POW2 | ( | x, | |
| p ) |
Aligns a value DOWN to the nearest power of 2.
| x | The value to align. |
| p | The alignment boundary (must be a power of 2). |
Definition at line 359 of file base_macros.h.
| #define ALIGN_UP_POW2 | ( | x, | |
| p ) |
Aligns a value UP to the nearest power of 2.
| x | The value to align. |
| p | The alignment boundary (must be a power of 2). |
Definition at line 351 of file base_macros.h.
| #define IS_POW2_OR_ZERO | ( | x | ) |
Checks if a given integer is a power of 2 (or zero).
| x | The value to check. |
Definition at line 366 of file base_macros.h.
| #define PACK_U32_LE | ( | a, | |
| b, | |||
| c, | |||
| d ) |
Packs 4 bytes into a 32-bit unsigned integer (little-endian order).
| a | Least significant byte. |
| b | Second byte. |
| c | Third byte. |
| d | Most significant byte. |
Definition at line 384 of file base_macros.h.
| #define SHIFT8 | ( | T, | |
| x, | |||
| s ) |
Shifts a byte value to a specific bit position.
| T | Target type (e.g., U32). |
| x | Value to shift. |
| s | Bit position (0, 8, 16, 24). |
Definition at line 374 of file base_macros.h.