summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-09-19 16:56:52 +0800
committeryangwei <[email protected]>2024-09-19 16:56:52 +0800
commit6d36a2fc9f1b378302aaaab9e931eff2e7db4c46 (patch)
tree496cea9a5c252ab5c439354cb48f3b4ebfdfe711 /include
parent7b32a86e66eefab011fdb33d9706528a66142ac4 (diff)
✨ feat(utils.h add count_of): mq clean using count_of
Diffstat (limited to 'include')
-rw-r--r--include/stellar/utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/stellar/utils.h b/include/stellar/utils.h
index 3d6ab43..16fd318 100644
--- a/include/stellar/utils.h
+++ b/include/stellar/utils.h
@@ -35,6 +35,10 @@
(type *)( (char *)__mptr - offsetof(type,member) ); })
#endif
+#ifndef count_of
+#define count_of(x) (sizeof(x) / sizeof(0 [x]))
+#endif
+
#ifndef likely
#define likely(x) __builtin_expect((x), 1)
#endif /* likely */