Zycore 1.5.1.0
|
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | ZYAN_MACRO_CONCAT(x, y) x ## y |
#define | ZYAN_MACRO_CONCAT_EXPAND(x, y) ZYAN_MACRO_CONCAT(x, y) |
#define | ZYAN_UNKNOWN_COMPILER |
#define | ZYAN_UNKNOWN_PLATFORM |
#define | ZYAN_USER |
#define | ZYAN_RELEASE |
#define | ZYAN_DEPRECATED |
#define | ZYAN_DLLEXPORT |
#define | ZYAN_DLLIMPORT |
#define | ZYCORE_EXPORT ZYAN_DLLIMPORT |
#define | ZYCORE_NO_EXPORT |
#define | ZYAN_NO_SANITIZE(what) |
#define | ZYAN_INLINE static inline |
#define | ZYAN_NOINLINE |
#define | ZYAN_ASSERT(condition) assert(condition) |
#define | ZYAN_STATIC_ASSERT(x) typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1] |
#define | ZYAN_UNREACHABLE for(;;) |
#define | ZYAN_UNUSED(x) (void)(x) |
#define | ZYAN_FALLTHROUGH |
#define | ZYAN_BITFIELD(x) : x |
#define | ZYAN_REQUIRES_LIBC |
#define | ZYAN_PRINTF_ATTR(format_index, first_to_check) |
#define | ZYAN_WPRINTF_ATTR(format_index, first_to_check) |
#define | ZYAN_ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0])) |
#define | ZYAN_MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define | ZYAN_MAX(a, b) (((a) > (b)) ? (a) : (b)) |
#define | ZYAN_ABS(a) (((a) < 0) ? -(a) : (a)) |
#define | ZYAN_IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0) |
#define | ZYAN_IS_ALIGNED_TO(x, align) (((x) & ((align) - 1)) == 0) |
#define | ZYAN_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1)) |
#define | ZYAN_ALIGN_DOWN(x, align) (((x) - 1) & ~((align) - 1)) |
#define | ZYAN_DIV64(n, divisor) (n /= divisor) |
#define | ZYAN_NEEDS_BIT(n, b) (((unsigned long)(n) >> (b)) > 0) |
#define | ZYAN_BITS_TO_REPRESENT(n) |
General helper and platform detection macros.
#define ZYAN_ABS | ( | a | ) | (((a) < 0) ? -(a) : (a)) |
Returns the absolute value of a
.
a | The value. |
a
. #define ZYAN_ALIGN_DOWN | ( | x, | |
align | |||
) | (((x) - 1) & ~((align) - 1)) |
Aligns the value to the nearest given alignment boundary (by rounding it down).
x | The value. |
align | The desired alignment. |
Note that this macro only works for powers of 2.
#define ZYAN_ALIGN_UP | ( | x, | |
align | |||
) | (((x) + (align) - 1) & ~((align) - 1)) |
Aligns the value to the nearest given alignment boundary (by rounding it up).
x | The value. |
align | The desired alignment. |
Note that this macro only works for powers of 2.
#define ZYAN_ARRAY_LENGTH | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
Returns the length (number of elements) of an array.
a | The name of the array. |
#define ZYAN_ASSERT | ( | condition | ) | assert(condition) |
Runtime debug assertion.
#define ZYAN_BITFIELD | ( | x | ) | : x |
Declares a bitfield.
x | The size (in bits) of the bitfield. |
#define ZYAN_BITS_TO_REPRESENT | ( | n | ) |
#define ZYAN_DIV64 | ( | n, | |
divisor | |||
) | (n /= divisor) |
Divide the 64bit integer value by the given divisor.
n | Variable containing the dividend that will be updated with the result of the division. |
divisor | The divisor. |
#define ZYAN_FALLTHROUGH |
Intentional fallthrough.
#define ZYAN_IS_ALIGNED_TO | ( | x, | |
align | |||
) | (((x) & ((align) - 1)) == 0) |
Checks, if the given value is properly aligned.
Note that this macro only works for powers of 2.
#define ZYAN_IS_POWER_OF_2 | ( | x | ) | (((x) & ((x) - 1)) == 0) |
Checks, if the given value is a power of 2.
x | The value. |
ZYAN_TRUE
, if the given value is a power of 2 or ZYAN_FALSE
, if not.Note that this macro always returns ZYAN_TRUE
for x == 0
.
#define ZYAN_MACRO_CONCAT | ( | x, | |
y | |||
) | x ## y |
Concatenates two values using the stringify operator (##
).
x | The first value. |
y | The second value. |
#define ZYAN_MACRO_CONCAT_EXPAND | ( | x, | |
y | |||
) | ZYAN_MACRO_CONCAT(x, y) |
Concatenates two values using the stringify operator (##
) and expands the value to be used in another macro.
x | The first value. |
y | The second value. |
#define ZYAN_MAX | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Returns the bigger value of a
or b
.
a | The first value. |
b | The second value. |
a
or b
. #define ZYAN_MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Returns the smaller value of a
or b
.
a | The first value. |
b | The second value. |
a
or b
. #define ZYAN_PRINTF_ATTR | ( | format_index, | |
first_to_check | |||
) |
Decorator for printf
-style functions.
format_index | The 1-based index of the format string parameter. |
first_to_check | The 1-based index of the format arguments parameter. |
#define ZYAN_REQUIRES_LIBC |
Marks functions that require libc (cannot be used with ZYAN_NO_LIBC
).
#define ZYAN_STATIC_ASSERT | ( | x | ) | typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1] |
Compiler-time assertion.
#define ZYAN_UNREACHABLE for(;;) |
Marks the current code path as unreachable.
#define ZYAN_UNUSED | ( | x | ) | (void)(x) |
Marks the specified parameter as unused.
x | The name of the unused parameter. |
#define ZYAN_WPRINTF_ATTR | ( | format_index, | |
first_to_check | |||
) |
Decorator for wprintf
-style functions.
format_index | The 1-based index of the format string parameter. |
first_to_check | The 1-based index of the format arguments parameter. |
#define ZYCORE_EXPORT ZYAN_DLLIMPORT |
Symbol is exported in shared library builds.
#define ZYCORE_NO_EXPORT |
Symbol is not exported and for internal use only.