diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2025-07-07 08:59:41 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2025-07-26 14:19:51 -0400 |
commit | bfc69fd326bd823c454c9fffa62748650a1a81dd (patch) | |
tree | 8463ca8ef8d19d9ececcb97242c1ff8055fedafa /src | |
parent | 2cd69d3ee34a6d2c21aa64aedf262827eb83826f (diff) | |
download | bfs-bfc69fd326bd823c454c9fffa62748650a1a81dd.tar.xz |
bfs.h: New BFS_VA_IF(A)(B)(C) macro
Diffstat (limited to 'src')
-rw-r--r-- | src/bfs.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -59,6 +59,25 @@ extern const char bfs_ldlibs[]; // Fundamental utilities /** + * A preprocessor conditional. + * + * BFS_VA_IF(A)(B)(C) => B + * BFS_VA_IF( )(B)(C) => C + */ +#define BFS_VA_IF(...) BFS_VA_IF_AB ## __VA_OPT__(C) +// BFS_VA_IF(A)(B)(C) => BFS_VA_IF_ABC(B)(C) +// BFS_VA_IF( )(B)(C) => BFS_VA_IF_AB(B)(C) + +#define BFS_VA_IF_ABC(...) __VA_ARGS__ BFS_VA_IGNORE +// BFS_VA_IF_ABC(B)(C) => B BFS_VA_IGNORE(C) + +#define BFS_VA_IF_AB(...) BFS_VA_REPEAT +// BFS_VA_IF_AB(B)(C) => BFS_VA_REPEAT(C) + +#define BFS_VA_IGNORE(...) +#define BFS_VA_REPEAT(...) __VA_ARGS__ + +/** * False sharing/destructive interference/largest cache line size. */ #ifdef __GCC_DESTRUCTIVE_SIZE |