liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
algorithm library
Collaboration diagram for algorithm library:

Topics

 floating-point number
 
 AVL binary search tree
 
 basic buffer library
 
 complex number
 
 Cyclic Redundancy Check
 
 fuzzy operator
 
 High Pass Filter
 
 circular doubly linked list
 
 Low Pass Filter
 
 mathematical algorithm library
 
 membership function
 
 note frequency table
 
 proportional integral derivative controller
 
 fuzzy proportional integral derivative controller
 
 single neuron proportional integral derivative controller
 
 polynomial
 
 basic queue library
 
 red–black binary search tree
 
 regression
 
 singly linked list
 
 basic string library
 
 transfer function
 
 bell-shaped velocity trajectory
 
 cubic polynomial trajectory
 
 quintic polynomial trajectory
 
 hepta polynomial trajectory
 
 trapezoidal velocity trajectory
 
 Unicode Transformation Format
 
 basic vector library
 
 algorithm library version
 

Data Structures

union  a_cast
 

Macros

#define A_BUILD_ASSERT(x)
 
#define A_BUILD_BUG_ON(x)
 
#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)
 
#define a_void_(_, x)
 
#define a_void   void
 
#define A_TRUE   true
 
#define A_FALSE   false
 
#define A_BOOL   bool
 
#define a_bool_c(x)
 
#define a_bool   A_BOOL
 
#define A_INT   int
 
#define A_INT_MIN   INT_MIN
 
#define A_INT_MAX   INT_MAX
 
#define a_int_c(x)
 
#define a_int_(_, x)
 
#define a_int   A_INT
 
#define A_UINT   unsigned int
 
#define A_UINT_MAX   UINT_MAX
 
#define a_uint_c(x)
 
#define a_uint_(_, x)
 
#define a_uint   A_UINT
 
#define A_SHRT   short
 
#define A_SHRT_MIN   SHRT_MIN
 
#define A_SHRT_MAX   SHRT_MAX
 
#define a_shrt_c(x)
 
#define a_shrt_(_, x)
 
#define a_shrt   A_SHRT
 
#define A_USHRT   unsigned short
 
#define A_USHRT_MAX   USHRT_MAX
 
#define a_ushrt_c(x)
 
#define a_ushrt_(_, x)
 
#define a_ushrt   A_USHRT
 
#define A_LONG   long
 
#define A_LONG_MIN   LONG_MIN
 
#define A_LONG_MAX   LONG_MAX
 
#define a_long_c(x)
 
#define a_long_(_, x)
 
#define a_long   A_LONG
 
#define A_ULONG   unsigned long
 
#define A_ULONG_MAX   ULONG_MAX
 
#define a_ulong_c(x)
 
#define a_ulong_(_, x)
 
#define a_ulong   A_ULONG
 
#define A_BYTE   unsigned char
 
#define A_BYTE_MAX   UCHAR_MAX
 
#define a_byte_c(x)
 
#define a_byte_(_, x)
 
#define a_byte   A_BYTE
 
#define A_C8   char
 
#define A_C8_MIN   CHAR_MIN
 
#define A_C8_MAX   CHAR_MAX
 
#define a_c8_c(x)
 
#define a_c8_(_, x)
 
#define a_c8   A_C8
 
#define A_I8   int8_t
 
#define a_i8_c(x)
 
#define a_i8_(_, x)
 
#define a_i8   A_I8
 
#define A_U8   uint8_t
 
#define a_u8_c(x)
 
#define a_u8_(_, x)
 
#define a_u8   A_U8
 
#define A_I16   int16_t
 
#define a_i16_c(x)
 
#define a_i16_(_, x)
 
#define a_i16   A_I16
 
#define A_U16   uint16_t
 
#define a_u16_c(x)
 
#define a_u16_(_, x)
 
#define a_u16   A_U16
 
#define A_I32   int32_t
 
#define a_i32_c(x)
 
#define a_i32_(_, x)
 
#define a_i32   A_I32
 
#define A_U32   uint32_t
 
#define a_u32_c(x)
 
#define a_u32_(_, x)
 
#define a_u32   A_U32
 
#define A_I64   int64_t
 
#define a_i64_c(x)
 
#define a_i64_(_, x)
 
#define a_i64   A_I64
 
#define A_U64   uint64_t
 
#define a_u64_c(x)
 
#define a_u64_(_, x)
 
#define a_u64   A_U64
 
#define A_IMAX   intmax_t
 
#define a_imax_c(x)
 
#define a_imax_(_, x)
 
#define a_imax   A_IMAX
 
#define A_UMAX   uintmax_t
 
#define a_umax_c(x)
 
#define a_umax_(_, x)
 
#define a_umax   A_UMAX
 
#define A_IPTR   intptr_t
 
#define a_iptr_c(x)
 
#define a_iptr_(_, x)
 
#define a_iptr   A_IPTR
 
#define A_UPTR   uintptr_t
 
#define a_uptr_c(x)
 
#define a_uptr_(_, x)
 
#define a_uptr   A_UPTR
 
#define A_DIFF   ptrdiff_t
 
#define a_diff_c(x)
 
#define a_diff_(_, x)
 
#define a_diff   A_DIFF
 
#define A_SIZE   size_t
 
#define a_size_c(x)
 
#define a_size_(_, x)
 
#define a_size   A_SIZE
 
#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, A_F64_INF)
 
#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_PRI(F, C)
 
#define A_F32_SCN(F, C)
 
#define a_f32_c(x)
 
#define a_f32_(_, x)
 
#define a_f32   A_F32
 
#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_PRI(F, C)
 
#define A_F64_SCN(F, C)
 
#define a_f64_c(x)
 
#define a_f64_(_, x)
 
#define a_f64   A_F64
 
#define A_SQ(x)
 square of x, \( x^2 \)
 
#define A_ABS(x)
 absolute value of x, \( |x| \)
 
#define A_ABS_(f, g)
 absolute value of f-g, \( |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, \( \texttt{sgn}(x)=\begin{cases}+1&x>0\\0&0\\-1&x<0\end{cases} \)
 
#define A_SGN_(f, g)
 signum function, \( \texttt{sgn}(f,g)=\begin{cases}+1&f>g\\0&f=g\\-1&f<g\end{cases} \)
 
#define A_SAT(x, min, max)
 saturation value of x, \( \texttt{sat}(x,min,max)=\begin{cases}min&min>x\\max&x>max\\x&else\end{cases} \)
 
#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_reverse(I, i, n)
 iterate from n to 0 and not include n
 
#define a_foreach(T, P, it, ptr, num)
 iterate over an array
 
#define a_forsafe(T, P, it, ptr, num)
 iterate over an array
 
#define a_foreach_reverse(T, P, it, ptr, num)
 iterate over an array in reverse
 
#define a_forsafe_reverse(T, P, it, ptr, num)
 iterate over an array in reverse
 
#define a_iterate(T, P, it, ptr, end)
 iterate over an array
 
#define a_iterate_reverse(T, P, it, ptr, end)
 iterate over an array in reverse
 
#define A_ALLOC(alloc, addr, size)
 declare allocation function
 
#define a_new(T, ptr, num)
 
#define a_die(ptr)
 

Typedefs

typedef union a_cast a_cast
 

Enumerations

enum  { A_SUCCESS , A_FAILURE , A_INVALID }
 enumeration for return values More...
 

Functions

uint8_t a_u8_rev (uint8_t x)
 reverse the bits in an 8-bit unsigned integer
 
uint16_t a_u16_rev (uint16_t x)
 reverse the bits in a 16-bit unsigned integer
 
uint16_t a_u16_getl (void const *b)
 
uint16_t a_u16_getb (void const *b)
 
void a_u16_setl (void *b, uint16_t x)
 
void a_u16_setb (void *b, uint16_t x)
 
uint32_t a_u32_rev (uint32_t x)
 reverse the bits in a 32-bit unsigned integer
 
uint32_t a_u32_getl (void const *b)
 
uint32_t a_u32_getb (void const *b)
 
void a_u32_setl (void *b, uint32_t x)
 
void a_u32_setb (void *b, uint32_t x)
 
uint64_t a_u64_rev (uint64_t x)
 reverse the bits in a 64-bit unsigned integer
 
uint64_t a_u64_getl (void const *b)
 
uint64_t a_u64_getb (void const *b)
 
void a_u64_setl (void *b, uint64_t x)
 
void a_u64_setb (void *b, uint64_t x)
 
void * a_copy (void *__restrict dst, void const *__restrict src, size_t siz)
 copy one buffer to another
 
void * a_move (void *dst, void const *src, size_t siz)
 move one buffer to another
 
void * a_fill (void *ptr, size_t siz, int val)
 fill a buffer with a character
 
void * a_zero (void *ptr, size_t siz)
 fill a buffer with zero
 
void a_swap (void *lhs, void *rhs, size_t siz)
 swap two different memory blocks of the same size
 
uint32_t a_hash_bkdr (void const *str, uint32_t val)
 a hash function whose prime number is 131
 
uint32_t a_hash_bkdr_ (void const *ptr, size_t siz, uint32_t val)
 a hash function whose prime number is 131
 
uint32_t a_hash_sdbm (void const *str, uint32_t val)
 a hash function whose prime number is 65599
 
uint32_t a_hash_sdbm_ (void const *ptr, size_t siz, uint32_t val)
 a hash function whose prime number is 65599
 
void a_float_push_fore (double *p, size_t n, double x)
 push an element into the front of a float array
 
void a_float_push_back (double *p, size_t n, double x)
 push an element into the end of a float array
 
void a_float_push_fore_ (double *block_p, size_t block_n, double const *cache_p, size_t cache_n)
 push the elements into the front of a float array
 
void a_float_push_back_ (double *block_p, size_t block_n, double const *cache_p, size_t cache_n)
 push the elements into the end of a float array
 
void a_float_roll_fore (double *p, size_t n)
 roll forward the elements of a float array circularly
 
void a_float_roll_back (double *p, size_t n)
 roll backward the elements of a float array circularly
 
void a_float_roll_fore_ (double *block_p, size_t block_n, double *shift_p, size_t shift_n)
 roll forward the elements of a float array circularly
 
void a_float_roll_back_ (double *block_p, size_t block_n, double *shift_p, size_t shift_n)
 roll backward the elements of a float array circularly
 
double a_float_mean (double const *p, size_t n)
 calculate the mean of a float array
 
double a_float_sum (double const *p, size_t n)
 calculate the sum of a float array
 
double a_float_sum1 (double const *p, size_t n)
 calculate the absolute sum of a float array
 
double a_float_sum2 (double const *p, size_t n)
 calculate the sum of squares of a float array
 
void * a_alloc_ (void *addr, size_t size)
 default allocation function
 

Variables

void *(* a_alloc )(void *addr, size_t size)
 allocation function pointer
 

Detailed Description

Macro Definition Documentation

◆ A_ABS

#define A_ABS ( x)
Value:
((x) < 0 ? -(x) : (x))

absolute value of x, \( |x| \)

◆ A_ABS_

#define A_ABS_ ( f,
g )
Value:
((f) < (g) ? (g) - (f) : (f) - (g))

absolute value of f-g, \( |f-g| \)

◆ a_align_down

#define a_align_down ( a,
p )
Value:
a_cast_r(void *, a_cast_r(a_uptr, p) & ~a_cast_s(a_uptr, (a) - 1))
#define a_uptr
Definition a.h:583

round pointer p down to the closest a, aligned address <= p

◆ a_align_up

#define a_align_up ( a,
p )
Value:
a_cast_r(void *, (a_cast_r(a_uptr, p) + (a) - 1) & ~a_cast_s(a_uptr, (a) - 1))

round pointer p up to the closest a, aligned address >= p

◆ A_ALLOC

#define A_ALLOC ( alloc,
addr,
size )
Value:
void *alloc(void *addr, a_size size)
#define a_size
Definition a.h:610

declare allocation function

◆ a_bool

#define a_bool   A_BOOL

type, capable of holding one of the two values: 1 and 0

◆ a_bool_c

#define a_bool_c ( x)
Value:
(!!(x))

static cast to a_bool

◆ A_BUILD_ASSERT

#define A_BUILD_ASSERT ( x)
Value:
(void)(sizeof(char[1 - 2 * !(x)]))

assert a build-time dependency, as an expression

◆ A_BUILD_BUG_ON

#define A_BUILD_BUG_ON ( x)
Value:
(void)(sizeof(char[1 - 2 * !!(x)]))

◆ a_byte

#define a_byte   A_BYTE

type for unsigned character representation

◆ a_byte_

#define a_byte_ ( _,
x )
Value:
a_cast_s(A_BYTE _, x)

◆ a_byte_c

#define a_byte_c ( x)
Value:
a_cast_s(A_BYTE, x)

static cast to a_byte

◆ a_c8

#define a_c8   A_C8

type for character representation

◆ a_c8_

#define a_c8_ ( _,
x )
Value:
a_cast_s(A_C8 _, x)

◆ a_c8_c

#define a_c8_c ( x)
Value:
a_cast_s(A_C8, x)

static cast to a_c8

◆ A_CAST_1

#define A_CAST_1 ( a)
Value:
#a

◆ A_CAST_2

#define A_CAST_2 ( a,
b )
Value:
a##b

◆ A_CAST_3

#define A_CAST_3 ( a,
b,
c )
Value:
a##b##c

◆ a_cast_c

#define a_cast_c ( T,
x )
Value:
const_cast<T>(x)

◆ a_cast_d

#define a_cast_d ( T,
x )
Value:
dynamic_cast<T>(x)

◆ a_cast_r

#define a_cast_r ( T,
x )
Value:
reinterpret_cast<T>(x)

◆ a_cast_s

#define a_cast_s ( T,
x )
Value:
static_cast<T>(x)

◆ a_container_of

#define a_container_of ( ptr,
type,
member )
Value:
a_cast_r(type *, a_cast_r(a_uptr, ptr) - a_offsetof(type, member))
#define a_offsetof(type, member)
offset of a structure member
Definition a.h:879

container of a structure member

Parameters
ptrpointer to a member variable
typestructure type
membermember variable

◆ a_die

#define a_die ( ptr)
Value:
a_alloc(ptr, 0)
void *(* a_alloc)(void *addr, size_t size)
allocation function pointer
Definition a.h:1420

◆ a_diff

#define a_diff   A_DIFF

signed integer type returned when subtracting two pointers

◆ a_diff_

#define a_diff_ ( _,
x )
Value:
a_cast_s(A_DIFF _, x)

◆ a_diff_c

#define a_diff_c ( x)
Value:
a_cast_s(A_DIFF, x)

static cast to a_diff

◆ a_f32

#define a_f32   A_F32

single precision floating point type. Matches IEEE-754 binary32 format if supported.

◆ a_f32_

#define a_f32_ ( _,
x )
Value:
a_cast_s(A_F32 _, x)

◆ A_F32_C

#define A_F32_C ( X)
Value:
A_CAST_2(X, F)

◆ a_f32_c

#define a_f32_c ( x)
Value:
a_cast_s(A_F32, x)

static cast to a_f32

◆ A_F32_F

#define A_F32_F ( F)
Value:
A_CAST_2(F, f)

◆ A_F32_PRI

#define A_F32_PRI ( F,
C )
Value:
"%" F C

format constants for the fprintf family of functions

◆ A_F32_SCN

#define A_F32_SCN ( F,
C )
Value:
"%" F C

format constants for the fscanf family of functions

◆ a_f64

#define a_f64   A_F64

double precision floating point type. Matches IEEE-754 binary64 format if supported.

◆ a_f64_

#define a_f64_ ( _,
x )
Value:
a_cast_s(A_F64 _, x)

◆ A_F64_C

#define A_F64_C ( X)
Value:
X

◆ a_f64_c

#define a_f64_c ( x)
Value:
a_cast_s(A_F64, x)

static cast to a_f64

◆ A_F64_F

#define A_F64_F ( F)
Value:
F

◆ A_F64_PRI

#define A_F64_PRI ( F,
C )
Value:
"%" F "l" C

format constants for the fprintf family of functions

◆ A_F64_SCN

#define A_F64_SCN ( F,
C )
Value:
"%" F "l" C

format constants for the fscanf family of functions

◆ a_foreach

#define a_foreach ( T,
P,
it,
ptr,
num )
Value:
for (T P it = a_cast_s(T P, ptr), P it##_ = it + (num); it < it##_; ++it)

iterate over an array

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
numnumber of elements in this array

◆ a_foreach_reverse

#define a_foreach_reverse ( T,
P,
it,
ptr,
num )
Value:
for (T P it##_ = a_cast_s(T P, ptr) - 1, P it = it##_ + (num); it > it##_; --it)

iterate over an array in reverse

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
numnumber of elements in this array

◆ a_forenum

#define a_forenum ( I,
i,
n )
Value:
for (I i = 0; i < (n); ++i)

iterate from 0 to n and not include n

Parameters
Iindex type of the iteration
iindex variable of the iteration
nfinal value of the iteration

◆ a_forenum_reverse

#define a_forenum_reverse ( I,
i,
n )
Value:
for (I i = (n); i-- > 0;)

iterate from n to 0 and not include n

Parameters
Iindex type of the iteration
iindex variable of the iteration
nfinal value of the iteration

◆ a_forsafe

#define a_forsafe ( T,
P,
it,
ptr,
num )
Value:
for (T P it = a_cast_s(T P, ptr), P it##_ = (num) ? it + (num) : it; it < it##_; ++it)

iterate over an array

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
numnumber of elements in this array

◆ a_forsafe_reverse

#define a_forsafe_reverse ( T,
P,
it,
ptr,
num )
Value:
for (T P it##_ = (num) ? a_cast_s(T P, ptr) - 1 : a_cast_s(T P, ptr), \
P it = (num) ? it##_ + (num) : it##_; \
it > it##_; --it)

iterate over an array in reverse

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
numnumber of elements in this array

◆ a_i16

#define a_i16   A_I16

signed integer type with width of exactly 16 bits

◆ a_i16_

#define a_i16_ ( _,
x )
Value:
a_cast_s(A_I16 _, x)

◆ a_i16_c

#define a_i16_c ( x)
Value:
a_cast_s(A_I16, x)

static cast to a_i16

◆ a_i32

#define a_i32   A_I32

signed integer type with width of exactly 32 bits

◆ a_i32_

#define a_i32_ ( _,
x )
Value:
a_cast_s(A_I32 _, x)

◆ a_i32_c

#define a_i32_c ( x)
Value:
a_cast_s(A_I32, x)

static cast to a_i32

◆ a_i64

#define a_i64   A_I64

signed integer type with width of exactly 64 bits

◆ a_i64_

#define a_i64_ ( _,
x )
Value:
a_cast_s(A_I64 _, x)

◆ a_i64_c

#define a_i64_c ( x)
Value:
a_cast_s(A_I64, x)

static cast to a_i64

◆ a_i8

#define a_i8   A_I8

signed integer type with width of exactly 8 bits

◆ a_i8_

#define a_i8_ ( _,
x )
Value:
a_cast_s(A_I8 _, x)

◆ a_i8_c

#define a_i8_c ( x)
Value:
a_cast_s(A_I8, x)

static cast to a_i8

◆ a_imax

#define a_imax   A_IMAX

maximum-width signed integer type

◆ a_imax_

#define a_imax_ ( _,
x )
Value:
a_cast_s(A_IMAX _, x)

◆ a_imax_c

#define a_imax_c ( x)
Value:
a_cast_s(A_IMAX, x)

static cast to a_imax

◆ a_int

#define a_int   A_INT

signed integer type is guaranteed to be at least 16 bits

◆ a_int_

#define a_int_ ( _,
x )
Value:
a_cast_s(A_INT _, x)

◆ a_int_c

#define a_int_c ( x)
Value:
a_cast_s(A_INT, x)

static cast to a_int

◆ a_iptr

#define a_iptr   A_IPTR

signed integer type capable of holding a pointer to void

◆ a_iptr_

#define a_iptr_ ( _,
x )
Value:
a_cast_s(A_IPTR _, x)

◆ a_iptr_c

#define a_iptr_c ( x)
Value:
a_cast_s(A_IPTR, x)

static cast to a_iptr

◆ a_iterate

#define a_iterate ( T,
P,
it,
ptr,
end )
Value:
for (T P it = a_cast_s(T P, ptr), P it##_ = a_cast_s(T P, end); it < it##_; ++it)

iterate over an array

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
endthe end address of this array

◆ a_iterate_reverse

#define a_iterate_reverse ( T,
P,
it,
ptr,
end )
Value:
for (T P it = a_cast_s(T P, end) - 1, P it##_ = a_cast_s(T P, ptr) - 1; it > it##_; --it)

iterate over an array in reverse

Parameters
Tthe prefix of the element type
Pthe suffix of the element type
itpointer to the current element
ptrstarting address of this array
endthe end address of this array

◆ A_LEN

#define A_LEN ( a)
Value:
(sizeof(a) / sizeof(*(a)))

number of elements in a visible array

Parameters
amust be a visible array

◆ a_long

#define a_long   A_LONG

signed integer type is guaranteed to be at least 32 bits

◆ a_long_

#define a_long_ ( _,
x )
Value:
a_cast_s(A_LONG _, x)

◆ a_long_c

#define a_long_c ( x)
Value:
a_cast_s(A_LONG, x)

static cast to a_long

◆ A_MAX

#define A_MAX ( x,
y )
Value:
(((x) > (y)) ? (x) : (y))

maximum value between x and y

◆ A_MIN

#define A_MIN ( x,
y )
Value:
(((x) < (y)) ? (x) : (y))

minimum value between x and y

◆ a_new

#define a_new ( T,
ptr,
num )
Value:
a_cast_s(T *, a_alloc(ptr, sizeof(T) * (num)))

◆ a_offsetof

#define a_offsetof ( type,
member )
Value:
a_cast_r(a_size, &a_cast_r(type *, 0)->member)

offset of a structure member

Parameters
typestructure type
membermember variable

◆ A_SAT

#define A_SAT ( x,
min,
max )
Value:
((min) < (x) ? (x) < (max) ? (x) : (max) : (min))

saturation value of x, \( \texttt{sat}(x,min,max)=\begin{cases}min&min>x\\max&x>max\\x&else\end{cases} \)

◆ A_SGN

#define A_SGN ( x)
Value:
((0 < (x)) - ((x) < 0))

signum function, \( \texttt{sgn}(x)=\begin{cases}+1&x>0\\0&0\\-1&x<0\end{cases} \)

◆ A_SGN_

#define A_SGN_ ( f,
g )
Value:
(((f) > (g)) - ((f) < (g)))

signum function, \( \texttt{sgn}(f,g)=\begin{cases}+1&f>g\\0&f=g\\-1&f<g\end{cases} \)

◆ a_shrt

#define a_shrt   A_SHRT

signed integer type is guaranteed to be at least 16 bits

◆ a_shrt_

#define a_shrt_ ( _,
x )
Value:
a_cast_s(A_SHRT _, x)

◆ a_shrt_c

#define a_shrt_c ( x)
Value:
a_cast_s(A_SHRT, x)

static cast to a_shrt

◆ a_size

#define a_size   A_SIZE

unsigned integer type returned by the sizeof operator

◆ a_size_

#define a_size_ ( _,
x )
Value:
a_cast_s(A_SIZE _, x)

◆ a_size_c

#define a_size_c ( x)
Value:
a_cast_s(A_SIZE, x)

static cast to a_size

◆ a_size_down

#define a_size_down ( a,
n )
Value:
(a_cast_s(a_size, n) & ~a_cast_s(a_size, (a) - 1))

round down size n to be a multiple of a

◆ a_size_up

#define a_size_up ( a,
n )
Value:
((a_cast_s(a_size, n) + (a) - 1) & ~a_cast_s(a_size, (a) - 1))

round up size n to be a multiple of a

◆ A_SQ

#define A_SQ ( x)
Value:
((x) * (x))

square of x, \( x^2 \)

◆ a_u16

#define a_u16   A_U16

unsigned integer type with width of exactly 16 bits

◆ a_u16_

#define a_u16_ ( _,
x )
Value:
a_cast_s(A_U16 _, x)

◆ a_u16_c

#define a_u16_c ( x)
Value:
a_cast_s(A_U16, x)

static cast to a_u16

◆ a_u32

#define a_u32   A_U32

unsigned integer type with width of exactly 32 bits

◆ a_u32_

#define a_u32_ ( _,
x )
Value:
a_cast_s(A_U32 _, x)

◆ a_u32_c

#define a_u32_c ( x)
Value:
a_cast_s(A_U32, x)

static cast to a_u32

◆ a_u64

#define a_u64   A_U64

unsigned integer type with width of exactly 64 bits

◆ a_u64_

#define a_u64_ ( _,
x )
Value:
a_cast_s(A_U64 _, x)

◆ a_u64_c

#define a_u64_c ( x)
Value:
a_cast_s(A_U64, x)

static cast to a_u64

◆ a_u8

#define a_u8   A_U8

unsigned integer type with width of exactly 8 bits

◆ a_u8_

#define a_u8_ ( _,
x )
Value:
a_cast_s(A_U8 _, x)

◆ a_u8_c

#define a_u8_c ( x)
Value:
a_cast_s(A_U8, x)

static cast to a_u8

◆ a_uint

#define a_uint   A_UINT

unsigned integer type is guaranteed to be at least 16 bits

◆ a_uint_

#define a_uint_ ( _,
x )
Value:
a_cast_s(A_UINT _, x)

◆ a_uint_c

#define a_uint_c ( x)
Value:
a_cast_s(A_UINT, x)

static cast to a_uint

◆ a_ulong

#define a_ulong   A_ULONG

unsigned integer type is guaranteed to be at least 32 bits

◆ a_ulong_

#define a_ulong_ ( _,
x )
Value:
a_cast_s(A_ULONG _, x)

◆ a_ulong_c

#define a_ulong_c ( x)
Value:
a_cast_s(A_ULONG, x)

static cast to a_ulong

◆ a_umax

#define a_umax   A_UMAX

maximum-width unsigned integer type

◆ a_umax_

#define a_umax_ ( _,
x )
Value:
a_cast_s(A_UMAX _, x)

◆ a_umax_c

#define a_umax_c ( x)
Value:
a_cast_s(A_UMAX, x)

static cast to a_umax

◆ a_uptr

#define a_uptr   A_UPTR

unsigned integer type capable of holding a pointer to void

◆ a_uptr_

#define a_uptr_ ( _,
x )
Value:
a_cast_s(A_UPTR _, x)

◆ a_uptr_c

#define a_uptr_c ( x)
Value:
a_cast_s(A_UPTR, x)

static cast to a_uptr

◆ a_ushrt

#define a_ushrt   A_USHRT

unsigned integer type is guaranteed to be at least 16 bits

◆ a_ushrt_

#define a_ushrt_ ( _,
x )
Value:
a_cast_s(A_USHRT _, x)

◆ a_ushrt_c

#define a_ushrt_c ( x)
Value:
a_cast_s(A_USHRT, x)

static cast to a_ushrt

◆ a_void

#define a_void   void

incomplete type or no parameter or no return value

◆ a_void_

#define a_void_ ( _,
x )
Value:
a_cast_s(void _, x)

◆ a_void_c

#define a_void_c ( _,
x )
Value:
a_cast_s(void, x)

static cast to a_void

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

enumeration for return values

Enumerator
A_SUCCESS 

return success

A_FAILURE 

return failure

A_INVALID 

return invalid

Function Documentation

◆ a_alloc_()

void * a_alloc_ ( void * addr,
size_t size )

default allocation function

Parameters
[in]addraddress of memory block
[in]sizenew size of memory block
Returns
new address of memory block or null

◆ a_copy()

void * a_copy ( void *__restrict dst,
void const *__restrict src,
size_t siz )

copy one buffer to another

Parameters
[in]dstpointer to the object to copy to
[in]srcpointer to the object to copy from
[in]siznumber of bytes to copy
Returns
a copy of dest

◆ a_fill()

void * a_fill ( void * ptr,
size_t siz,
int val )

fill a buffer with a character

Parameters
[in]ptrpointer to the object to fill
[in]siznumber of bytes to fill
[in]valfill byte
Returns
a copy of dest

◆ a_float_mean()

double a_float_mean ( double const * p,
size_t n )

calculate the mean of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
Returns
mean of a float array

◆ a_float_push_back()

void a_float_push_back ( double * p,
size_t n,
double x )

push an element into the end of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
[in]xvalue

◆ a_float_push_back_()

void a_float_push_back_ ( double * block_p,
size_t block_n,
double const * cache_p,
size_t cache_n )

push the elements into the end of a float array

Parameters
[in]block_ppoints to a float array
[in]block_nnumber of a float array
[in]cache_ppoints to a cache array
[in]cache_nnumber of a cache array

◆ a_float_push_fore()

void a_float_push_fore ( double * p,
size_t n,
double x )

push an element into the front of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
[in]xvalue

◆ a_float_push_fore_()

void a_float_push_fore_ ( double * block_p,
size_t block_n,
double const * cache_p,
size_t cache_n )

push the elements into the front of a float array

Parameters
[in]block_ppoints to a float array
[in]block_nnumber of a float array
[in]cache_ppoints to a cache array
[in]cache_nnumber of a cache array

◆ a_float_roll_back()

void a_float_roll_back ( double * p,
size_t n )

roll backward the elements of a float array circularly

Parameters
[in]ppoints to a float array
[in]nnumber of a float array

◆ a_float_roll_back_()

void a_float_roll_back_ ( double * block_p,
size_t block_n,
double * shift_p,
size_t shift_n )

roll backward the elements of a float array circularly

Parameters
[in]block_ppoints to a float array
[in]block_nnumber of a float array
[in]shift_ppoints to a shift array
[in]shift_nnumber of a shift array

◆ a_float_roll_fore()

void a_float_roll_fore ( double * p,
size_t n )

roll forward the elements of a float array circularly

Parameters
[in]ppoints to a float array
[in]nnumber of a float array

◆ a_float_roll_fore_()

void a_float_roll_fore_ ( double * block_p,
size_t block_n,
double * shift_p,
size_t shift_n )

roll forward the elements of a float array circularly

Parameters
[in]block_ppoints to a float array
[in]block_nnumber of a float array
[in]shift_ppoints to a shift array
[in]shift_nnumber of a shift array

◆ a_float_sum()

double a_float_sum ( double const * p,
size_t n )

calculate the sum of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
Returns
sum of a float array

◆ a_float_sum1()

double a_float_sum1 ( double const * p,
size_t n )

calculate the absolute sum of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
Returns
absolute sum of a float array

◆ a_float_sum2()

double a_float_sum2 ( double const * p,
size_t n )

calculate the sum of squares of a float array

Parameters
[in]ppoints to a float array
[in]nnumber of a float array
Returns
sum of squares of a float array

◆ a_hash_bkdr()

uint32_t a_hash_bkdr ( void const * str,
uint32_t val )

a hash function whose prime number is 131

Parameters
[in]strstring to be processed
[in]valinitial value
Returns
hash value

◆ a_hash_bkdr_()

uint32_t a_hash_bkdr_ ( void const * ptr,
size_t siz,
uint32_t val )

a hash function whose prime number is 131

Parameters
[in]ptrpoints to string to be processed
[in]sizlength of string to be processed
[in]valinitial value
Returns
hash value

◆ a_hash_sdbm()

uint32_t a_hash_sdbm ( void const * str,
uint32_t val )

a hash function whose prime number is 65599

Parameters
[in]strstring to be processed
[in]valinitial value
Returns
hash value

◆ a_hash_sdbm_()

uint32_t a_hash_sdbm_ ( void const * ptr,
size_t siz,
uint32_t val )

a hash function whose prime number is 65599

Parameters
[in]ptrpoints to string to be processed
[in]sizlength of string to be processed
[in]valinitial value
Returns
hash value

◆ a_move()

void * a_move ( void * dst,
void const * src,
size_t siz )

move one buffer to another

Parameters
[in]dstpointer to the object to copy to
[in]srcpointer to the object to copy from
[in]siznumber of bytes to copy
Returns
a copy of dest

◆ a_swap()

void a_swap ( void * lhs,
void * rhs,
size_t siz )

swap two different memory blocks of the same size

Parameters
[in]sizthe size of memory block being swapped
[in,out]lhspoints to memory block on the left
[in,out]rhspoints to memory block on the right

◆ a_u16_rev()

uint16_t a_u16_rev ( uint16_t x)

reverse the bits in a 16-bit unsigned integer

Parameters
xa 16-bit unsigned integer to be reversed
Returns
reversed 16-bit unsigned integer

◆ a_u32_rev()

uint32_t a_u32_rev ( uint32_t x)

reverse the bits in a 32-bit unsigned integer

Parameters
xa 32-bit unsigned integer to be reversed
Returns
reversed 32-bit unsigned integer

◆ a_u64_rev()

uint64_t a_u64_rev ( uint64_t x)

reverse the bits in a 64-bit unsigned integer

Parameters
xa 64-bit unsigned integer to be reversed
Returns
reversed 64-bit unsigned integer

◆ a_u8_rev()

uint8_t a_u8_rev ( uint8_t x)

reverse the bits in an 8-bit unsigned integer

Parameters
xan 8-bit unsigned integer to be reversed
Returns
reversed 8-bit unsigned integer

◆ a_zero()

void * a_zero ( void * ptr,
size_t siz )

fill a buffer with zero

Parameters
[in]ptrpointer to the object to fill
[in]siznumber of bytes to fill
Returns
a copy of dest

Variable Documentation

◆ a_alloc

void *(* a_alloc) (void *addr, size_t size) ( void * addr,
size_t size )

allocation function pointer

Parameters
[in]addraddress of memory block
[in]sizenew size of memory block
Returns
new address of memory block or null