macros: implement count_of()

master
S.J.R. van Schaik 7 years ago
parent 928487b58e
commit 8c8e7fc67c
  1. 2
      include/macros.h

@ -17,6 +17,8 @@
#define MIB (1024 * KIB)
#define GIB (1024 * MIB)
#define count_of(x) (sizeof(x) / sizeof(*(x)))
#define container_of(ptr, type, member) \
(type *)((char *)ptr - offsetof(type, member))

Loading…
Cancel
Save