summaryrefslogtreecommitdiff
path: root/src/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/macros.h')
-rw-r--r--src/macros.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/macros.h b/src/macros.h
index 58cdca2..422bb8b 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2024 Richard Braun.
+ * Copyright (c) 2024-2025 Richard Braun.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted.
@@ -19,7 +19,9 @@
#ifndef MACROS_H
#define MACROS_H
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+#define DIV_CEIL(n, d) (((n) + (d) - 1) / (d))
#define structof(ptr, type, member) \
((type *)((char *)(ptr) - offsetof(type, member)))