Data Structures | |
union | a_cast |
Macros | |
#define | A_ORDER_LITTLE 1234 |
byte order of little endian architecture | |
#define | A_ORDER_BIG 4321 |
byte order of big endian architecture | |
#define | A_BYTE_ORDER 1234 |
byte order of architecture | |
#define | A_SIZE_POINTER 4 |
size of void pointer | |
#define | A_BUILD_ASSERT(x) |
assert a build-time dependency, as an expression | |
#define | A_BUILD_BUG_ON(x) |
assert a build-time dependency, as an expression | |
#define | a_cast_r(T, x) |
#define | a_cast_d(T, x) |
#define | a_cast_s(T, x) |
#define | a_cast_c(T, x) |
#define | A_CAST_3(a, b, c) |
#define | A_CAST_2(a, b) |
#define | A_CAST_1(a) |
#define | A_NULL NULL |
#define | a_void_c(x) |
static cast to a_void | |
#define | a_void_(_, x) |
#define | a_void void |
incomplete type or no parameter or no return value | |
#define | A_TRUE true |
#define | A_FALSE false |
#define | A_BOOL bool |
#define | a_bool_c(x) |
static cast to a_bool | |
#define | A_INT int |
#define | A_INT_MAX INT_MAX |
#define | A_INT_MIN INT_MIN |
#define | a_int_c(x) |
static cast to a_int | |
#define | a_int_(_, x) |
#define | A_UINT unsigned int |
#define | A_UINT_MAX UINT_MAX |
#define | a_uint_c(x) |
static cast to a_uint | |
#define | a_uint_(_, x) |
#define | A_SHRT short |
#define | A_SHRT_MAX SHRT_MAX |
#define | A_SHRT_MIN SHRT_MIN |
#define | a_shrt_c(x) |
static cast to a_shrt | |
#define | a_shrt_(_, x) |
#define | A_USHRT unsigned short |
#define | A_USHRT_MAX USHRT_MAX |
#define | a_ushrt_c(x) |
static cast to a_ushrt | |
#define | a_ushrt_(_, x) |
#define | A_LONG long |
#define | A_LONG_MIN LONG_MIN |
#define | A_LONG_MAX LONG_MAX |
#define | a_long_c(x) |
static cast to a_long | |
#define | a_long_(_, x) |
#define | A_ULONG unsigned long |
#define | A_ULONG_MAX ULONG_MAX |
#define | a_ulong_c(x) |
static cast to a_ulong | |
#define | a_ulong_(_, x) |
#define | A_BYTE unsigned char |
#define | A_BYTE_MAX UCHAR_MAX |
#define | a_byte_c(x) |
static cast to a_byte | |
#define | a_byte_(_, x) |
#define | A_C8 char |
#define | A_C8_MAX CHAR_MAX |
#define | A_C8_MIN CHAR_MIN |
#define | a_c8_c(x) |
static cast to a_c8 | |
#define | a_c8_(_, x) |
#define | A_I8 signed char |
#define | A_I8_C(X) |
#define | A_I8_MAX A_I8_C(0x7F) |
#define | A_I8_MIN A_I8_C(~0x7F) |
#define | a_i8_c(x) |
static cast to a_i8 | |
#define | a_i8_(_, x) |
#define | A_U8 unsigned char |
#define | A_U8_C(X) |
#define | A_U8_MAX A_U8_C(0xFF) |
#define | a_u8_c(x) |
static cast to a_u8 | |
#define | a_u8_(_, x) |
#define | A_PRI8 |
#define | A_SCN8 "hh" |
#define | A_I16 short |
#define | A_I16_C(X) |
#define | A_I16_MAX A_I16_C(0x7FFF) |
#define | A_I16_MIN A_I16_C(~0x7FFF) |
#define | a_i16_c(x) |
static cast to a_i16 | |
#define | a_i16_(_, x) |
#define | A_U16 unsigned short |
#define | A_U16_C(X) |
#define | A_U16_MAX A_U16_C(0xFFFF) |
#define | a_u16_c(x) |
static cast to a_u16 | |
#define | a_u16_(_, x) |
#define | A_PRI16 |
#define | A_SCN16 "h" |
#define | A_I32 long |
#define | A_I32_C(X) |
#define | A_I32_MAX A_I32_C(0x7FFFFFFF) |
#define | A_I32_MIN A_I32_C(~0x7FFFFFFF) |
#define | a_i32_c(x) |
static cast to a_i32 | |
#define | a_i32_(_, x) |
#define | A_U32 unsigned long |
#define | A_U32_C(X) |
#define | A_U32_MAX A_U32_C(0xFFFFFFFF) |
#define | a_u32_c(x) |
static cast to a_u32 | |
#define | a_u32_(_, x) |
#define | A_PRI32 "l" |
#define | A_SCN32 "l" |
#define | A_I64 long |
#define | A_I64_C(X) |
#define | A_I64_MAX A_I64_C(0x7FFFFFFFFFFFFFFF) |
#define | A_I64_MIN A_I64_C(~0x7FFFFFFFFFFFFFFF) |
#define | a_i64_c(x) |
static cast to a_i64 | |
#define | a_i64_(_, x) |
#define | A_U64 unsigned long |
#define | A_U64_C(X) |
#define | A_U64_MAX A_U64_C(0xFFFFFFFFFFFFFFFF) |
#define | a_u64_c(x) |
static cast to a_u64 | |
#define | a_u64_(_, x) |
#define | A_PRI64 "l" |
#define | A_SCN64 "l" |
#define | A_IMAX A_I64 |
#define | A_IMAX_C(X) |
#define | A_IMAX_MAX A_I64_MAX |
#define | A_IMAX_MIN A_I64_MIN |
#define | a_imax_c(x) |
static cast to a_imax | |
#define | a_imax_(_, x) |
#define | A_UMAX A_U64 |
#define | A_UMAX_C(X) |
#define | A_UMAX_MAX A_U64_MAX |
#define | a_umax_c(x) |
static cast to a_umax | |
#define | a_umax_(_, x) |
#define | A_PRIMAX A_PRI64 |
#define | A_SCNMAX A_SCN64 |
#define | A_IPTR A_I32 |
#define | A_IPTR_MAX A_I32_MAX |
#define | A_IPTR_MIN A_I32_MIN |
#define | a_iptr_c(x) |
static cast to a_iptr | |
#define | a_iptr_(_, x) |
#define | A_UPTR A_U32 |
#define | A_UPTR_MAX A_U32_MAX |
#define | a_uptr_c(x) |
static cast to a_uptr | |
#define | a_uptr_(_, x) |
#define | A_PRIPTR A_PRI32 |
#define | A_SCNPTR A_SCN32 |
#define | A_DIFF ptrdiff_t |
#define | A_DIFF_MAX A_I32_MAX |
#define | A_DIFF_MIN A_I32_MIN |
#define | a_diff_c(x) |
static cast to a_diff | |
#define | a_diff_(_, x) |
#define | A_PRIt "t" |
#define | A_SCNt "t" |
#define | A_SIZE size_t |
#define | A_SIZE_MAX A_U32_MAX |
#define | a_size_c(x) |
static cast to a_size | |
#define | a_size_(_, x) |
#define | A_PRIz "z" |
#define | A_SCNz "z" |
#define | A_F16_NNAN A_U16_C(0xFE00) |
#define | A_F16_PNAN A_U16_C(0x7E00) |
#define | A_F16_NINF A_U16_C(0xFC00) |
#define | A_F16_PINF A_U16_C(0x7C00) |
#define | A_F32 float |
#define | A_F32_C(X) |
#define | A_F32_F(F) |
#define | A_F32_DIG FLT_DIG |
#define | A_F32_EPSILON FLT_EPSILON |
#define | A_F32_MANT_DIG FLT_MANT_DIG |
#define | A_F32_MAX FLT_MAX |
#define | A_F32_MAX_10_EXP FLT_MAX_10_EXP |
#define | A_F32_MAX_EXP FLT_MAX_EXP |
#define | A_F32_MIN FLT_MIN |
#define | A_F32_MIN_10_EXP FLT_MIN_10_EXP |
#define | A_F32_MIN_EXP FLT_MIN_EXP |
#define | A_F32_INF a_cast_s(a_f32, DBL_MAX) |
#define | A_F32_NAN (A_F32_C(0.0) * A_F32_INF) |
#define | A_F32_NNAN A_U32_C(0xFFC00000) |
#define | A_F32_PNAN A_U32_C(0x7FC00000) |
#define | A_F32_NINF A_U32_C(0xFF800000) |
#define | A_F32_PINF A_U32_C(0x7F800000) |
#define | a_f32_c(x) |
static cast to a_f32 | |
#define | a_f32_(_, x) |
#define | A_F64 double |
#define | A_F64_C(X) |
#define | A_F64_F(F) |
#define | A_F64_DIG DBL_DIG |
#define | A_F64_EPSILON DBL_EPSILON |
#define | A_F64_MANT_DIG DBL_MANT_DIG |
#define | A_F64_MAX DBL_MAX |
#define | A_F64_MAX_10_EXP DBL_MAX_10_EXP |
#define | A_F64_MAX_EXP DBL_MAX_EXP |
#define | A_F64_MIN DBL_MIN |
#define | A_F64_MIN_10_EXP DBL_MIN_10_EXP |
#define | A_F64_MIN_EXP DBL_MIN_EXP |
#define | A_F64_INF (DBL_MAX * DBL_MAX) |
#define | A_F64_NAN (A_F64_C(0.0) * A_F64_INF) |
#define | A_F64_NNAN A_U64_C(0xFFF8000000000000) |
#define | A_F64_PNAN A_U64_C(0x7FF8000000000000) |
#define | A_F64_NINF A_U64_C(0xFFF0000000000000) |
#define | A_F64_PINF A_U64_C(0x7FF0000000000000) |
#define | a_f64_c(x) |
static cast to a_f64 | |
#define | a_f64_(_, x) |
#define | A_SQ(x) |
square of x, | |
#define | A_ABS(x) |
absolute value of x, | |
#define | A_ABS_(f, g) |
absolute value of f-g, | |
#define | A_MIN(x, y) |
minimum value between x and y | |
#define | A_MAX(x, y) |
maximum value between x and y | |
#define | A_SGN(x) |
signum function, | |
#define | A_SGN_(f, g) |
signum function, | |
#define | A_SAT(x, min, max) |
saturation value of x, | |
#define | A_LEN(a) |
number of elements in a visible array | |
#define | a_offsetof(type, member) |
offset of a structure member | |
#define | a_container_of(ptr, type, member) |
container of a structure member | |
#define | a_size_down(a, n) |
round down size n to be a multiple of a | |
#define | a_size_up(a, n) |
round up size n to be a multiple of a | |
#define | a_align_down(a, p) |
round pointer p down to the closest a , aligned address <= p | |
#define | a_align_up(a, p) |
round pointer p up to the closest a , aligned address >= p | |
#define | a_forenum(I, i, n) |
iterate from 0 to n and not include n | |
#define | A_FORENUM(I, i, n) |
#define | a_forenum_reverse(I, i, n) |
iterate from n to 0 and not include n | |
#define | A_FORENUM_REVERSE(I, i, n) |
#define | a_foreach(T, S, it, ptr, num) |
iterate over an array | |
#define | A_FOREACH(T, it, at, ptr, num) |
#define | a_forsafe(T, S, it, ptr, num) |
iterate over an array | |
#define | A_FORSAFE(T, it, at, ptr, num) |
#define | a_foreach_reverse(T, S, it, ptr, num) |
iterate over an array in reverse | |
#define | A_FOREACH_REVERSE(T, it, at, ptr, num) |
#define | a_forsafe_reverse(T, S, it, ptr, num) |
iterate over an array in reverse | |
#define | A_FORSAFE_REVERSE(T, it, at, ptr, num) |
#define | a_iterate(T, S, it, ptr, end) |
iterate over an array | |
#define | A_ITERATE(T, it, at, ptr, end) |
#define | a_iterate_reverse(T, S, it, ptr, end) |
iterate over an array in reverse | |
#define | A_ITERATE_REVERSE(T, it, at, ptr, end) |
#define | A_ALLOC(alloc, addr, size) |
declare allocation function | |
#define | a_new(T, ptr, num) |
#define | a_die(ptr) |
Enumerations | |
enum | a_return_code { A_SUCCESS , A_FAILURE , A_INVALID , A_OBOUNDS , A_OMEMORY } |
enumeration for return values | |
Functions | |
a_u8 | a_u8_rev (a_u8 x) |
reverse the bits in an 8-bit unsigned integer | |
a_u16 | a_u16_rev (a_u16 x) |
reverse the bits in a 16-bit unsigned integer | |
a_u16 | a_u16_getl (void const *b) |
a_u16 | a_u16_getb (void const *b) |
void | a_u16_setl (void *b, a_u16 x) |
void | a_u16_setb (void *b, a_u16 x) |
a_u32 | a_u32_rev (a_u32 x) |
reverse the bits in a 32-bit unsigned integer | |
a_u32 | a_u32_getl (void const *b) |
a_u32 | a_u32_getb (void const *b) |
void | a_u32_setl (void *b, a_u32 x) |
void | a_u32_setb (void *b, a_u32 x) |
a_u64 | a_u64_rev (a_u64 x) |
reverse the bits in a 64-bit unsigned integer | |
a_u64 | a_u64_getl (void const *b) |
a_u64 | a_u64_getb (void const *b) |
void | a_u64_setl (void *b, a_u64 x) |
void | a_u64_setb (void *b, a_u64 x) |
void * | a_copy (void *__restrict dst, void const *__restrict src, a_size siz) |
copy one buffer to another | |
void * | a_move (void *dst, void const *src, a_size siz) |
move one buffer to another | |
void * | a_fill (void *ptr, a_size siz, int val) |
fill a buffer with a character | |
void * | a_zero (void *ptr, a_size siz) |
fill a buffer with zero | |
void | a_swap (void *lhs, void *rhs, a_size siz) |
swap two different memory blocks of the same size | |
void * | a_alloc_ (void *addr, a_size size) |
default allocation function | |
Variables | |
void *(* | a_alloc )(void *addr, a_size size) |
allocation function pointer | |
#define A_ABS | ( | x | ) |
absolute value of x,
#define A_ABS_ | ( | f, | |
g ) |
absolute value of f-g,
#define a_align_down | ( | a, | |
p ) |
#define a_align_up | ( | a, | |
p ) |
#define A_ALLOC | ( | alloc, | |
addr, | |||
size ) |
#define a_bool_c | ( | x | ) |
static cast to a_bool
#define A_BUILD_ASSERT | ( | x | ) |
assert a build-time dependency, as an expression
#define A_BUILD_BUG_ON | ( | x | ) |
assert a build-time dependency, as an expression
#define a_byte_ | ( | _, | |
x ) |
#define a_c8_ | ( | _, | |
x ) |
#define A_CAST_1 | ( | a | ) |
#define A_CAST_2 | ( | a, | |
b ) |
#define A_CAST_3 | ( | a, | |
b, | |||
c ) |
#define a_cast_c | ( | T, | |
x ) |
#define a_cast_d | ( | T, | |
x ) |
#define a_cast_r | ( | T, | |
x ) |
#define a_cast_s | ( | T, | |
x ) |
#define a_container_of | ( | ptr, | |
type, | |||
member ) |
container of a structure member
ptr | pointer to a member variable |
type | structure type |
member | member variable |
#define a_die | ( | ptr | ) |
#define a_diff_ | ( | _, | |
x ) |
#define a_f32_ | ( | _, | |
x ) |
#define A_F32_C | ( | X | ) |
#define A_F32_F | ( | F | ) |
#define a_f64_ | ( | _, | |
x ) |
#define A_F64_C | ( | X | ) |
#define A_F64_F | ( | F | ) |
#define A_FOREACH | ( | T, | |
it, | |||
at, | |||
ptr, | |||
num ) |
#define a_foreach | ( | T, | |
S, | |||
it, | |||
ptr, | |||
num ) |
iterate over an array
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
num | number of elements in this array |
#define A_FOREACH_REVERSE | ( | T, | |
it, | |||
at, | |||
ptr, | |||
num ) |
#define a_foreach_reverse | ( | T, | |
S, | |||
it, | |||
ptr, | |||
num ) |
iterate over an array in reverse
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
num | number of elements in this array |
#define A_FORENUM | ( | I, | |
i, | |||
n ) |
#define a_forenum | ( | I, | |
i, | |||
n ) |
iterate from 0 to n and not include n
I | index type of the iteration |
i | index variable of the iteration |
n | final value of the iteration |
#define A_FORENUM_REVERSE | ( | I, | |
i, | |||
n ) |
#define a_forenum_reverse | ( | I, | |
i, | |||
n ) |
iterate from n to 0 and not include n
I | index type of the iteration |
i | index variable of the iteration |
n | final value of the iteration |
#define A_FORSAFE | ( | T, | |
it, | |||
at, | |||
ptr, | |||
num ) |
#define a_forsafe | ( | T, | |
S, | |||
it, | |||
ptr, | |||
num ) |
iterate over an array
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
num | number of elements in this array |
#define A_FORSAFE_REVERSE | ( | T, | |
it, | |||
at, | |||
ptr, | |||
num ) |
#define a_forsafe_reverse | ( | T, | |
S, | |||
it, | |||
ptr, | |||
num ) |
iterate over an array in reverse
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
num | number of elements in this array |
#define a_i16_ | ( | _, | |
x ) |
#define A_I16_C | ( | X | ) |
#define a_i32_ | ( | _, | |
x ) |
#define A_I32_C | ( | X | ) |
#define a_i64_ | ( | _, | |
x ) |
#define A_I64_C | ( | X | ) |
#define a_i8_ | ( | _, | |
x ) |
#define A_I8_C | ( | X | ) |
#define a_imax_ | ( | _, | |
x ) |
#define A_IMAX_C | ( | X | ) |
#define a_int_ | ( | _, | |
x ) |
#define a_iptr_ | ( | _, | |
x ) |
#define A_ITERATE | ( | T, | |
it, | |||
at, | |||
ptr, | |||
end ) |
#define a_iterate | ( | T, | |
S, | |||
it, | |||
ptr, | |||
end ) |
iterate over an array
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
end | the end address of this array |
#define A_ITERATE_REVERSE | ( | T, | |
it, | |||
at, | |||
ptr, | |||
end ) |
#define a_iterate_reverse | ( | T, | |
S, | |||
it, | |||
ptr, | |||
end ) |
iterate over an array in reverse
T | the prefix of the element type |
S | the suffix of the element type |
it | pointer to the current element |
ptr | starting address of this array |
end | the end address of this array |
#define A_LEN | ( | a | ) |
number of elements in a visible array
a | must be a visible array |
#define a_long_ | ( | _, | |
x ) |
#define A_MAX | ( | x, | |
y ) |
maximum value between x and y
#define A_MIN | ( | x, | |
y ) |
minimum value between x and y
#define a_new | ( | T, | |
ptr, | |||
num ) |
#define a_offsetof | ( | type, | |
member ) |
offset of a structure member
type | structure type |
member | member variable |
#define A_SAT | ( | x, | |
min, | |||
max ) |
saturation value of x,
#define A_SGN | ( | x | ) |
signum function,
#define A_SGN_ | ( | f, | |
g ) |
signum function,
#define a_shrt_ | ( | _, | |
x ) |
#define a_size_ | ( | _, | |
x ) |
#define a_size_down | ( | a, | |
n ) |
#define a_size_up | ( | a, | |
n ) |
#define A_SQ | ( | x | ) |
square of x,
#define a_u16_ | ( | _, | |
x ) |
#define A_U16_C | ( | X | ) |
#define a_u32_ | ( | _, | |
x ) |
#define A_U32_C | ( | X | ) |
#define a_u64_ | ( | _, | |
x ) |
#define A_U64_C | ( | X | ) |
#define a_u8_ | ( | _, | |
x ) |
#define A_U8_C | ( | X | ) |
#define a_uint_ | ( | _, | |
x ) |
#define a_ulong_ | ( | _, | |
x ) |
#define a_umax_ | ( | _, | |
x ) |
#define A_UMAX_C | ( | X | ) |
#define a_uptr_ | ( | _, | |
x ) |
#define a_ushrt_ | ( | _, | |
x ) |
#define a_void_ | ( | _, | |
x ) |
#define a_void_c | ( | x | ) |
static cast to a_void
void * a_alloc_ | ( | void * | addr, |
a_size | size ) |
default allocation function
[in] | addr | address of memory block |
[in] | size | new size of memory block |
void * a_copy | ( | void *__restrict | dst, |
void const *__restrict | src, | ||
a_size | siz ) |
copy one buffer to another
[in] | dst | pointer to the object to copy to |
[in] | src | pointer to the object to copy from |
[in] | siz | number of bytes to copy |
void * a_fill | ( | void * | ptr, |
a_size | siz, | ||
int | val ) |
fill a buffer with a character
[in] | ptr | pointer to the object to fill |
[in] | siz | number of bytes to fill |
[in] | val | fill byte |
void * a_move | ( | void * | dst, |
void const * | src, | ||
a_size | siz ) |
move one buffer to another
[in] | dst | pointer to the object to copy to |
[in] | src | pointer to the object to copy from |
[in] | siz | number of bytes to copy |
void a_swap | ( | void * | lhs, |
void * | rhs, | ||
a_size | siz ) |
swap two different memory blocks of the same size
[in,out] | lhs | points to memory block on the left |
[in,out] | rhs | points to memory block on the right |
[in] | siz | the size of memory block being swapped |
reverse the bits in a 16-bit unsigned integer
x | a 16-bit unsigned integer to be reversed |
reverse the bits in a 32-bit unsigned integer
x | a 32-bit unsigned integer to be reversed |
reverse the bits in a 64-bit unsigned integer
x | a 64-bit unsigned integer to be reversed |
reverse the bits in an 8-bit unsigned integer
x | an 8-bit unsigned integer to be reversed |
void * a_zero | ( | void * | ptr, |
a_size | siz ) |
fill a buffer with zero
[in] | ptr | pointer to the object to fill |
[in] | siz | number of bytes to fill |