DEFINES.H(3)
π include/Zycore/Defines.h π
okay so bestie, this is a page from the Library Functions Manual, and it's all about include/Zycore/Defines.h β the little header of helper macros and platform-detection goodies for Zycore. it's giving foundation energy. β¨
π NAME π
include/Zycore/Defines.h β yes that's literally it, that's the name, she's self-titled, main character behavior π
β¨ SYNOPSIS β¨
#include <assert.h>
π Macros π
here's the whole roster, no skipping, every single one:
#define ZYAN_MACRO_CONCAT(x, y)
#define ZYAN_MACRO_CONCAT_EXPAND(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)
#define ZYAN_STATIC_ASSERT(x)
#define ZYAN_UNREACHABLE for(;;)
#define ZYAN_UNUSED(x)
#define ZYAN_FALLTHROUGH
#define ZYAN_BITFIELD(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)
#define ZYAN_MIN(a, b)
#define ZYAN_MAX(a, b)
#define ZYAN_ABS(a)
#define ZYAN_IS_POWER_OF_2(x)
#define ZYAN_IS_ALIGNED_TO(x, align)
#define ZYAN_ALIGN_UP(x, align)
#define ZYAN_ALIGN_DOWN(x, align)
#define ZYAN_DIV64(n, divisor)
#define ZYAN_NEEDS_BIT(n, b)
#define ZYAN_BITS_TO_REPRESENT(n)
π¦ Detailed Description π¦
no cap, it's just: General helper and platform detection macros. that's the whole vibe. π
π Macro Definition Documentation π
alphabetical order, she's organized, we love that for her πΈ
#define ZYAN_ABS( a)
Value:
(((a) < 0) ? -(a) : (a))
returns the absolute value of a. (so like, if it's negative, we flip the attitude π )
Parameters
- a β the value.
Returns
- the absolute value of a.
#define ZYAN_ALIGN_DOWN( x, align)
Value:
(((x) - 1) & ~((align) - 1))
aligns the value to the nearest given alignment boundary (by rounding it down).
Parameters
- x β the value.
- align β the desired alignment.
Returns
- the aligned value.
β οΈ note that this macro only works for powers of 2, bestie. don't try it on anything else, it will not slay.
#define ZYAN_ALIGN_UP( x, align)
Value:
(((x) + (align) - 1) & ~((align) - 1))
aligns the value to the nearest given alignment boundary (by rounding it up).
Parameters
- x β the value.
- align β the desired alignment.
Returns
- the aligned value.
β οΈ again: this macro only works for powers of 2. same rules, same consequences π«Ά
#define ZYAN_ARRAY_LENGTH( a)
Value:
(sizeof(a) / sizeof((a)[0]))
returns the length (number of elements) of an array. iconic honestly.
Parameters
- a β the name of the array.
Returns
- the number of elements of the given array.
#define ZYAN_ASSERT( condition)
Value:
assert(condition)
runtime debug assertion. that's it, that's the whole thing π
#define ZYAN_BITFIELD( x)
Value:
: x
declares a bitfield.
Parameters
- x β the size (in bits) of the bitfield.
#define ZYAN_BITS_TO_REPRESENT( n)
Value:
( \
ZYAN_NEEDS_BIT(n, 0) + ZYAN_NEEDS_BIT(n, 1) + \
ZYAN_NEEDS_BIT(n, 2) + ZYAN_NEEDS_BIT(n, 3) + \
ZYAN_NEEDS_BIT(n, 4) + ZYAN_NEEDS_BIT(n, 5) + \
ZYAN_NEEDS_BIT(n, 6) + ZYAN_NEEDS_BIT(n, 7) + \
ZYAN_NEEDS_BIT(n, 8) + ZYAN_NEEDS_BIT(n, 9) + \
ZYAN_NEEDS_BIT(n, 10) + ZYAN_NEEDS_BIT(n, 11) + \
ZYAN_NEEDS_BIT(n, 12) + ZYAN_NEEDS_BIT(n, 13) + \
ZYAN_NEEDS_BIT(n, 14) + ZYAN_NEEDS_BIT(n, 15) + \
ZYAN_NEEDS_BIT(n, 16) + ZYAN_NEEDS_BIT(n, 17) + \
ZYAN_NEEDS_BIT(n, 18) + ZYAN_NEEDS_BIT(n, 19) + \
ZYAN_NEEDS_BIT(n, 20) + ZYAN_NEEDS_BIT(n, 21) + \
ZYAN_NEEDS_BIT(n, 22) + ZYAN_NEEDS_BIT(n, 23) + \
ZYAN_NEEDS_BIT(n, 24) + ZYAN_NEEDS_BIT(n, 25) + \
ZYAN_NEEDS_BIT(n, 26) + ZYAN_NEEDS_BIT(n, 27) + \
ZYAN_NEEDS_BIT(n, 28) + ZYAN_NEEDS_BIT(n, 29) + \
ZYAN_NEEDS_BIT(n, 30) + ZYAN_NEEDS_BIT(n, 31) \
)
#define ZYAN_DIV64( n, divisor)
Value:
(n /= divisor)
divide the 64bit integer value by the given divisor. she's a one-liner and she knows it π
Parameters
- n β variable containing the dividend that will be updated with the result of the division.
- divisor β the divisor.
#define ZYAN_FALLTHROUGH
intentional fallthrough. (the switch statement said "and then" and we meant it β¨)
#define ZYAN_IS_ALIGNED_TO( x, align)
Value:
(((x) & ((align) - 1)) == 0)
checks, if the given value is properly aligned.
β οΈ note that this macro only works for powers of 2. yes queen, same warning, different macro πΈ
#define ZYAN_IS_POWER_OF_2( x)
Value:
(((x) & ((x) - 1)) == 0)
checks, if the given value is a power of 2.
Parameters
- x β the value.
Returns
ZYAN_TRUE, if the given value is a power of 2 orZYAN_FALSE, if not.
β οΈ note that this macro always returnsZYAN_TRUEforx == 0. that's a real gotcha bestie, write it down π
#define ZYAN_MACRO_CONCAT( x, y)
Value:
x ## y
concatenates two values using the stringify operator (##).
Parameters
- x β the first value.
- y β the second value.
Returns
- the combined string of the given values.
#define ZYAN_MACRO_CONCAT_EXPAND( x, y)
Value:
ZYAN_MACRO_CONCAT(x, y)
concatenates two values using the stringify operator (##) and expands the value to be used in another macro. lowkey the glow-up version π
Parameters
- x β the first value.
- y β the second value.
Returns
- the combined string of the given values.
#define ZYAN_MAX( a, b)
Value:
(((a) > (b)) ? (a) : (b))
returns the bigger value of a or b.
Parameters
- a β the first value.
- b β the second value.
Returns
- the bigger value of a or b.
#define ZYAN_MIN( a, b)
Value:
(((a) < (b)) ? (a) : (b))
returns the smaller value of a or b.
Parameters
- a β the first value.
- b β the second value.
Returns
- the smaller value of a or b.
#define ZYAN_NEEDS_BIT( n, b)
Value:
(((unsigned long)(n) >> (b)) > 0)
(no extra prose here, just the value, she lets the bits speak for themselves π)
#define ZYAN_PRINTF_ATTR( format_index, first_to_check)
decorator for printf-style functions. it's giving compiler-please-check-my-formats energy π₯
Parameters
- 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).
β οΈ fr fr, if you're running with ZYAN_NO_LIBC, these functions are simply not invited to the party. π«
#define ZYAN_STATIC_ASSERT( x)
Value:
typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
compiler-time assertion. catching your mistakes before they even happen, that's self-care π
#define ZYAN_UNREACHABLE for(;;)
marks the current code path as unreachable. (we're never getting here and we said what we said π)
#define ZYAN_UNUSED( x)
Value:
(void)(x)
marks the specified parameter as unused.
Parameters
- x β the name of the unused parameter.
#define ZYAN_WPRINTF_ATTR( format_index, first_to_check)
decorator for wprintf-style functions. the wide-char sister of printf π
Parameters
- 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. she's out here being seen π
#define ZYCORE_NO_EXPORT
symbol is not exported and for internal use only. a private queen, we respect it π
π€ Author π€
generated automatically by Doxygen for Zycore from the source code. (not a human author, just the Doxygen machine doing its little thing, and honestly? ate. β¨)
and that's the whole page bestie π«Ά no notes, no missing macros, every last #define accounted for. go forth and concatenate responsibly π
Zycore β Version 1.5.2.0 β include/Zycore/Defines.h(3) β mwah, bye now! π
ππ¦
π¦ where this page comes from
- ubuntu resolute: libzycore-doc 1.5.2-1build1 Β· MIT
- ubuntu stonking: libzycore-doc 1.5.2-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms