From 1f7e8e937d0e71e7eb3b5deab38b34d0a0159d88 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 17 Sep 2026 21:50:34 +0200 Subject: Added include guards --- src/utils/compilers.h | 5 +++++ src/utils/constants.h | 5 +++++ src/utils/dbg_log.h | 5 +++++ src/utils/math.h | 5 +++++ src/utils/prefetch.h | 5 +++++ src/utils/sleep.h | 5 +++++ src/utils/utils.h | 5 +++++ src/utils/wrapthread.h | 5 +++++ 8 files changed, 40 insertions(+) (limited to 'src/utils') diff --git a/src/utils/compilers.h b/src/utils/compilers.h index 1b175bb..a2ae3ba 100644 --- a/src/utils/compilers.h +++ b/src/utils/compilers.h @@ -1,3 +1,6 @@ +#ifndef UTILS_COMPILERS_H +#define UTILS_COMPILERS_H + #if defined(__GNUC__) #define UNUSED __attribute__((unused)) @@ -22,3 +25,5 @@ a[static N] notation for array parameters). #define NON_NULL #endif + +#endif /* UTILS_COMPILERS_H */ diff --git a/src/utils/constants.h b/src/utils/constants.h index 3eed27d..3d0f6e3 100644 --- a/src/utils/constants.h +++ b/src/utils/constants.h @@ -1,3 +1,6 @@ +#ifndef UTILS_CONSTANTS_H +#define UTILS_CONSTANTS_H + #define UINT8_BIT(i) (UINT8_C(1) << (uint8_t)(i)) #define FACTORIAL_MAX UINT64_C(12) @@ -42,3 +45,5 @@ STATIC uint64_t binomial[12][12] = { {1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, 0}, {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, }; + +#endif /* UTILS_CONSTANTS_H */ diff --git a/src/utils/dbg_log.h b/src/utils/dbg_log.h index 08d42a3..f22260a 100644 --- a/src/utils/dbg_log.h +++ b/src/utils/dbg_log.h @@ -1,3 +1,6 @@ +#ifndef UTILS_DBG_LOG_H +#define UTILS_DBG_LOG_H + #include void (*nissy_log)(const char *, void *); @@ -31,3 +34,5 @@ write_wrapper(void (*write)(const char *, void *), const char *str, ...) #define DBG_WARN(condition, ...) #define DBG_ASSERT(condition, ...) #endif + +#endif /* UTILS_DBG_LOG_H */ diff --git a/src/utils/math.h b/src/utils/math.h index 0c56861..66ddaed 100644 --- a/src/utils/math.h +++ b/src/utils/math.h @@ -1,3 +1,6 @@ +#ifndef UTILS_MATH_H +#define UTILS_MATH_H + #define SWAP(x, y) do { x ^= y; y ^= x; x ^= y; } while (0) #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) @@ -146,3 +149,5 @@ intpow(double b, uint64_t e) return e % 2 == 0 ? r * r : b * r * r; } + +#endif /* UTILS_MATH_H */ diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h index a2c41ef..30e364e 100644 --- a/src/utils/prefetch.h +++ b/src/utils/prefetch.h @@ -1,3 +1,6 @@ +#ifndef UTILS_PREFETCH_H +#define UTILS_PREFETCH_H + #if defined(__GNUC__) || defined(__clang__) #define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) #elif defined(AVX2) @@ -5,3 +8,5 @@ #else #define prefetch(a, i) (void)i #endif + +#endif /* UTILS_PREFETCH_H */ diff --git a/src/utils/sleep.h b/src/utils/sleep.h index 7c0a84d..28bb807 100644 --- a/src/utils/sleep.h +++ b/src/utils/sleep.h @@ -1,3 +1,6 @@ +#ifndef UTILS_SLEEP_H +#define UTILS_SLEEP_H + #define BASE_SLEEP_TIME 500 STATIC void msleep(int); @@ -50,3 +53,5 @@ msleep(int milliseconds) } #endif + +#endif /* UTILS_SLEEP_H */ diff --git a/src/utils/utils.h b/src/utils/utils.h index e322f20..e320105 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -1,3 +1,6 @@ +#ifndef UTILS_UTILS_H +#define UTILS_UTILS_H + #include "compilers.h" #include "dbg_log.h" #include "constants.h" @@ -5,3 +8,5 @@ #include "sleep.h" #include "wrapthread.h" #include "prefetch.h" + +#endif /* UTILS_UTILS_H */ diff --git a/src/utils/wrapthread.h b/src/utils/wrapthread.h index 9578293..e88eb58 100644 --- a/src/utils/wrapthread.h +++ b/src/utils/wrapthread.h @@ -1,3 +1,6 @@ +#ifndef UTILS_WRAPTHREAD_H +#define UTILS_WRAPTHREAD_H + #if THREADS == 1 #define WRAPTHREAD_NOTHREADS 1 #elif defined(__unix__) @@ -75,3 +78,5 @@ #define wrapthread_mutex_unlock(a) #endif + +#endif /* UTILS_WRAPTHREAD_H */ -- cgit v1.3