3.1. Types

wchar_t

Wide chars.

bool

Boolean. Its value can be true or false.

int8
int16
int32
int64
uint8
uint16
uint32
uint64

Integer basic type.

SWAP(type, x)
SWAP_TO_BE(type, x)
SWAP_FROM_BE(type, x)
SWAP_TO_LE(type, x)
SWAP_FROM_LE(type, x)

Byte swapping utility macro. The type should be the C type of the value x (ie. int32, uint64...).

GET_BIT(v, i)
SET_BIT(v, i, x)

Get and sets the bit i from an integer v.

GET_BITS(v, i, j)
SET_BITS(v, i, j, x)

Get and sets the bits in range [i ; j] from an integer v.

3.2. Utilities

3.2.1. Errors

void error(const wchar_t *error, ...)

Set an error message to be reported to the callers. The function follows the printf API and can be used in multi-threaded application. The error can then be retrieved using clear_error() and check_error().

const char *errno_error(int err)

Convert the errno value to a human readable error message.

Note

The returned string will be erased by the next call to this function. The function thread-safe and can be used in multi-threaded application.

bool check_error()

Check if an error has occurred. This function does not clear error flag.

const wchar_t *clear_error()

Get the error message and clear the error state.