Primatives for number manipulation.
More...
Go to the source code of this file.
|
#define | _AC(num, suf) __tok(num, suf) |
| Create an integer usable in both C and Assembly, even when suf is needed. More...
|
|
#define | KB(num) (_AC(num, ULL) << 10) |
| Express num in Kilobytes. More...
|
|
#define | MB(num) (_AC(num, ULL) << 20) |
| Express num in Megabytes. More...
|
|
#define | GB(num) (_AC(num, ULL) << 30) |
| Express num in Gigabytes. More...
|
|
#define | TB(num) (_AC(num, ULL) << 40) |
| Express num in Terabytes. More...
|
|
#define | IS_ALIGNED(val, align) (((val) & ((align) - 1)) == 0) |
| Return a boolean indicating whether val is aligned on align . More...
|
|
#define | MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m))) |
|
#define | MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m)) |
|
#define | _p(v) ((void*)(unsigned long)(v)) |
| Express an abitrary integer v as void *. More...
|
|
#define | _u(v) ((unsigned long)(v)) |
| Express an arbitrary value v as unsigned long. More...
|
|
Primatives for number manipulation.
Definition in file numbers.h.
◆ _AC
#define _AC |
( |
|
num, |
|
|
|
suf |
|
) |
| __tok(num, suf) |
Create an integer usable in both C and Assembly, even when suf
is needed.
Definition at line 16 of file numbers.h.
◆ KB
#define KB |
( |
|
num | ) |
(_AC(num, ULL) << 10) |
Express num
in Kilobytes.
Definition at line 23 of file numbers.h.
◆ MB
#define MB |
( |
|
num | ) |
(_AC(num, ULL) << 20) |
Express num
in Megabytes.
Definition at line 26 of file numbers.h.
◆ GB
#define GB |
( |
|
num | ) |
(_AC(num, ULL) << 30) |
Express num
in Gigabytes.
Definition at line 29 of file numbers.h.
◆ TB
#define TB |
( |
|
num | ) |
(_AC(num, ULL) << 40) |
Express num
in Terabytes.
Definition at line 32 of file numbers.h.
◆ IS_ALIGNED
#define IS_ALIGNED |
( |
|
val, |
|
|
|
align |
|
) |
| (((val) & ((align) - 1)) == 0) |
Return a boolean indicating whether val
is aligned on align
.
align
is required to be exact power of two.
Definition at line 38 of file numbers.h.
◆ MASK_EXTR
#define MASK_EXTR |
( |
|
v, |
|
|
|
m |
|
) |
| (((v) & (m)) / ((m) & -(m))) |
◆ MASK_INSR
#define MASK_INSR |
( |
|
v, |
|
|
|
m |
|
) |
| (((v) * ((m) & -(m))) & (m)) |
◆ _p
#define _p |
( |
|
v | ) |
((void*)(unsigned long)(v)) |
Express an abitrary integer v
as void *.
Definition at line 48 of file numbers.h.
◆ _u
#define _u |
( |
|
v | ) |
((unsigned long)(v)) |
Express an arbitrary value v
as unsigned long.
Definition at line 53 of file numbers.h.