|
#define | MB (1024UL << 10UL) |
|
#define | GB (MB << 10UL) |
|
#define | metal_unused(x) do { (x) = (x); } while (0) |
| Marker for unused function arguments/variables. More...
|
|
#define | metal_dim(x) (sizeof(x) / sizeof(x[0])) |
| Figure out number of elements in an array. More...
|
|
#define | metal_min(x, y) ((x) < (y) ? (x) : (y)) |
| Minimum of two numbers (warning: multiple evaluation!). More...
|
|
#define | metal_max(x, y) ((x) > (y) ? (x) : (y)) |
| Maximum of two numbers (warning: multiple evaluation!). More...
|
|
#define | metal_sign(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) |
| Sign of a number [-1, 0, or 1] (warning: multiple evaluation!). More...
|
|
#define | metal_align_down(size, align) ((size) & ~((align) - 1)) |
| Align 'size' down to a multiple of 'align' (must be a power of two). More...
|
|
#define | metal_align_up(size, align) metal_align_down((size) + (align) - 1, align) |
| Align 'size' up to a multiple of 'align' (must be a power of two). More...
|
|
#define | metal_div_round_down(num, den) ((num) / (den)) |
| Divide (and round down). More...
|
|
#define | metal_div_round_up(num, den) metal_div_round_down((num) + (den) - 1, (den)) |
| Divide (and round up). More...
|
|
#define | metal_ptr_align_down(ptr, align) (void *)(metal_align_down((uintptr_t)(ptr), (uintptr_t)(align))) |
| Align 'ptr' down to a multiple of 'align' (must be a power of two). More...
|
|
#define | metal_ptr_align_up(ptr, align) (void *)(metal_align_up((uintptr_t)(ptr), (uintptr_t)(align))) |
| Align 'ptr' up to a multiple of 'align' (must be a power of two). More...
|
|
#define | metal_offset_of(structure, member) ((uintptr_t)&(((structure *)0)->member)) |
| Compute offset of a field within a structure. More...
|
|
#define | metal_container_of(ptr, structure, member) (void *)((uintptr_t)(ptr) - metal_offset_of(structure, member)) |
| Compute pointer to a structure given a pointer to one of its fields. More...
|
|
#define | METAL_BITS_PER_ULONG (CHAR_BIT * sizeof(unsigned long)) |
|
#define | metal_bit(bit) (1UL << (bit)) |
|
#define | metal_bitmap_longs(x) metal_div_round_up((x), METAL_BITS_PER_ULONG) |
|
#define | metal_bitmap_for_each_set_bit(bitmap, bit, max) |
|
#define | metal_bitmap_for_each_clear_bit(bitmap, bit, max) |
|