|
cbase 1.46.11
C/C++ Static Template
|
Quality-of-life macros for strings, pointers, and math. More...
Macros | |
| #define | STRINGIFY_DETAIL(x) |
| Internal implementation of STRINGIFY. Do not use directly. | |
| #define | STRINGIFY(x) |
| Safely converts a macro argument into a string literal. | |
| #define | GLUE_DETAIL(x, y) |
| Internal implementation of GLUE. Do not use directly. | |
| #define | GLUE(x, y) |
| Safely concatenates two tokens together into a single token. | |
| #define | INT_FROM_PTR(ptr) |
| Safely casts a pointer to an integer of pointer size. | |
| #define | PTR_FROM_INT(type, val) |
| Safely casts a pointer-sized integer back to a specific pointer type. | |
| #define | ARRAY_SIZE(arr) |
| Calculates the number of elements in a statically allocated array. | |
| #define | MIN(a, b) |
| Returns the minimum of two values (Standard C fallback). | |
| #define | MAX(a, b) |
| Returns the maximum of two values (Standard C fallback). | |
| #define | CLAMP(val, min, max) |
| Clamps a value between a minimum and a maximum (Standard C fallback). | |
| #define | SWAP(type, a, b) |
| Generic variable swap. | |
| #define | Boolify(x) |
| Safely converts any scalar value to a strict 1 or 0 boolean. | |
| #define | AsciiID4(a, b, c, d) |
| Packs four 8-bit ASCII characters into a single 32-bit integer (FourCC). | |
| #define | ExpandAsciiID(x) |
| Expands a 32-bit FourCC integer for use in a printf format string (e.g. "%.*s"). | |
Quality-of-life macros for strings, pointers, and math.
| #define ARRAY_SIZE | ( | arr | ) |
Calculates the number of elements in a statically allocated array.
| arr | The static array. |
Definition at line 252 of file base_macros.h.
| #define AsciiID4 | ( | a, | |
| b, | |||
| c, | |||
| d ) |
Packs four 8-bit ASCII characters into a single 32-bit integer (FourCC).
| a | 1st character. |
| b | 2nd character. |
| c | 3rd character. |
| d | 4th character. |
Definition at line 330 of file base_macros.h.
| #define Boolify | ( | x | ) |
Safely converts any scalar value to a strict 1 or 0 boolean.
| x | The value to evaluate. |
Definition at line 321 of file base_macros.h.
| #define CLAMP | ( | val, | |
| min, | |||
| max ) |
Clamps a value between a minimum and a maximum (Standard C fallback).
Definition at line 301 of file base_macros.h.
| #define ExpandAsciiID | ( | x | ) |
Expands a 32-bit FourCC integer for use in a printf format string (e.g. "%.*s").
| x | The integer to expand. |
Definition at line 336 of file base_macros.h.
| #define GLUE | ( | x, | |
| y ) |
Safely concatenates two tokens together into a single token.
| x | The first token. |
| y | The second token. |
Definition at line 229 of file base_macros.h.
| #define GLUE_DETAIL | ( | x, | |
| y ) |
Internal implementation of GLUE. Do not use directly.
Definition at line 223 of file base_macros.h.
| #define INT_FROM_PTR | ( | ptr | ) |
Safely casts a pointer to an integer of pointer size.
| ptr | The pointer to cast. |
Definition at line 236 of file base_macros.h.
| #define MAX | ( | a, | |
| b ) |
Returns the maximum of two values (Standard C fallback).
Definition at line 299 of file base_macros.h.
| #define MIN | ( | a, | |
| b ) |
Returns the minimum of two values (Standard C fallback).
Definition at line 297 of file base_macros.h.
| #define PTR_FROM_INT | ( | type, | |
| val ) |
Safely casts a pointer-sized integer back to a specific pointer type.
| type | The type of pointer to return (e.g., int, struct Node). |
| val | The integer memory address. |
Definition at line 244 of file base_macros.h.
| #define STRINGIFY | ( | x | ) |
Safely converts a macro argument into a string literal.
| x | The token to stringify. If it is a macro, it will be expanded first. |
Definition at line 220 of file base_macros.h.
| #define STRINGIFY_DETAIL | ( | x | ) |
Internal implementation of STRINGIFY. Do not use directly.
Definition at line 214 of file base_macros.h.
| #define SWAP | ( | type, | |
| a, | |||
| b ) |
Generic variable swap.
| type | The data type of the variables being swapped (e.g., int, float). |
| a | The first variable. |
| b | The second variable. |
Definition at line 310 of file base_macros.h.