Add function to count element in arrays.

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-06-29 15:48:56 -04:00
parent d6c4dc3184
commit 3ed59b6f55
2 changed files with 3 additions and 3 deletions
+3
View File
@@ -68,3 +68,6 @@ typedef unsigned int pgprot_t;
/// Returns the alignment, in bytes, of the specified type.
#define alignof(type) offsetof( \
struct { char c; type member; }, member)
/// Counts the number of elements of an array.
#define count_of(x) ((sizeof(x) / sizeof((x)[0])) / ((size_t)(!(sizeof(x) % sizeof((x)[0])))))