aboutsummaryrefslogtreecommitdiffstats
path: root/include/container.h
diff options
context:
space:
mode:
authorjustanothercatgirl <sotov@twistea.su>2025-02-02 18:20:53 +0300
committerjustanothercatgirl <sotov@twistea.su>2025-02-02 18:27:43 +0300
commit8989b7dc005af7960aa66fd99b197a3b0b7a4fbc (patch)
tree55637fcffc4d60d2917df17521b7e8f059981b8c /include/container.h
parent2d5e1fa41c65c70ad18c5912a79190d08e6d9e98 (diff)
Fixed formatting
Diffstat (limited to 'include/container.h')
-rw-r--r--include/container.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/include/container.h b/include/container.h
index c84b894..9491477 100644
--- a/include/container.h
+++ b/include/container.h
@@ -19,24 +19,24 @@ typedef unsigned char byte;
/// Find closest powers of 2
#ifdef __GNUC__
- #define upper_2_power_32(number) (32 - __builtin_clz(number))
- #define upper_2_power_64(number) (64 - __builtin_clzl(number))
+# define upper_2_power_32(number) (32 - __builtin_clz(number))
+# define upper_2_power_64(number) (64 - __builtin_clzl(number))
#else
- #include <intrin.h>
- #include <stdint.h>
- #define upper_2_power_32(number) __bit_scan_32(number)
- #define upper_2_power_64(number) __bit_scan_64(number)
+# include <intrin.h>
+# include <stdint.h>
+# define upper_2_power_32(number) __bit_scan_32(number)
+# define upper_2_power_64(number) __bit_scan_64(number)
unsigned long __bit_scan_32(int32_t number);
unsigned long __bit_scan_64(int64_t number);
#endif
/// define FALLTHROUGH macro
#if defined(__clang__) || defined(__GNUC__)
-#define FALLTHROUGH __attribute__((fallthrough))
+# define FALLTHROUGH __attribute__((fallthrough))
#elif defined(_MSC_VER)
-#define FALLTHROUGH __fallthrough()
+# define FALLTHROUGH __fallthrough()
#else
-#define FALLTHROUGH ((void)0)
+# define FALLTHROUGH ((void)0)
#endif
/// define TODO macro
@@ -50,14 +50,14 @@ typedef void*(*memcpy_t)(void* restrict, const void*, size_t);
/// default qsort_cmp_t functions to be used with integral types.
#ifdef CONTAINER_EXPOSE_HELPERS
- #define _CONTAINER_STATIC
+# define _CONTAINER_STATIC
int __default_char_cmp(const void* a, const void* b);
int __default_short_cmp(const void* a, const void* b);
int __default_int_cmp(const void* a, const void* b);
int __default_long_cmp(const void* a, const void* b);
int __default_long_long_cmp(const void* a, const void* b);
#else
- #define _CONTAINER_STATIC static
+# define _CONTAINER_STATIC static
#endif // CONTAINER_EXPOSE_HELPERS
@@ -279,10 +279,10 @@ struct linked_list ll_deep_copy(const struct linked_list* list, memcpy_t cpy);
/* ----------------------------------------------------------------- */
#ifndef HMAP_MAX_BUCKET_SIZE
- #define HMAP_MAX_BUCKET_SIZE 8
+# define HMAP_MAX_BUCKET_SIZE 8
#endif
#ifndef HMAP_INIT_SIZE
- #define HMAP_INIT_SIZE 32
+# define HMAP_INIT_SIZE 32
#endif
/// should return `0` only if first argument is equal to second,
/// otherwise should return `1` or any other integer
@@ -365,10 +365,10 @@ char hmapi_end(const struct hash_map_iter* iter);
/* ----------------------------------------------------------------- */
#ifndef HSET_MAX_BUCKET_SIZE
- #define HSET_MAX_BUCKET_SIZE 8
+# define HSET_MAX_BUCKET_SIZE 8
#endif
#ifndef HSET_INIT_SIZE
- #define HSET_INIT_SIZE 32
+# define HSET_INIT_SIZE 32
#endif
/// should return `0` only if first argument is equal to second,
/// otherwise should return `1` or any other integer
@@ -472,32 +472,32 @@ void* _array_extend(void* array, void* buffer, size_t len);
#ifndef __GNUC__
unsigned long __bit_scan_32(int32_t number) {
- #ifdef _MSC_VER
+# ifdef _MSC_VER
unsigned long index;
if (_BitScanReverse(&index, number)) {
return index + 1;
} else {
return 1;
}
- #else // _MSC_VER
+# else // _MSC_VER
unsigned long count;
for (count = 0; number; number >>= 1) { ++count; }
return count;
- #endif // _MSC_VER
+# endif // _MSC_VER
}
unsigned long __bit_scan_64(int64_t number) {
- #ifdef _MSC_VER
+# ifdef _MSC_VER
unsigned long index;
if (_BitScanReverse64(&index, number)) {
return index + 1;
} else {
return 1;
}
- #else // _MSC_VER
+# else // _MSC_VER
unsigned long count;
for (count = 0; number; number >>= 1) { ++count; }
return count;
- #endif // _MSC_VER
+# endif // _MSC_VER
}
#endif // __GNUC__