summaryrefslogtreecommitdiff
path: root/src/basic/macro.h
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-05-27 10:51:47 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-06-01 03:40:20 +0900
commit4c8d7caf1a6fbc9abac627ddf974ed219258f9a8 (patch)
tree397dbb52cb9a6a068379a81531022721eda35853 /src/basic/macro.h
parent394129f88b54a8a0886fe0f9867e2e9603eb0694 (diff)
downloadsystemd-4c8d7caf1a6fbc9abac627ddf974ed219258f9a8.tar.gz
macro: make ALIGN4() and ALIGN8() also return SIZE_MAX on overflow
This also drops unused ALIGN4_PTR(), ALIGN8_PTR(), and ALIGN_TO_PTR().
Diffstat (limited to 'src/basic/macro.h')
-rw-r--r--src/basic/macro.h19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 9727279155..e3ee7bfee9 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -110,25 +110,6 @@
#error "neither int nor long are four bytes long?!?"
#endif
-/* Rounds up */
-
-#define ALIGN4(l) (((l) + 3) & ~3)
-#define ALIGN8(l) (((l) + 7) & ~7)
-
-#if __SIZEOF_POINTER__ == 8
-#define ALIGN(l) ALIGN8(l)
-#elif __SIZEOF_POINTER__ == 4
-#define ALIGN(l) ALIGN4(l)
-#else
-#error "Wut? Pointers are neither 4 nor 8 bytes long?"
-#endif
-
-#define ALIGN_PTR(p) ((void*) ALIGN((unsigned long) (p)))
-#define ALIGN4_PTR(p) ((void*) ALIGN4((unsigned long) (p)))
-#define ALIGN8_PTR(p) ((void*) ALIGN8((unsigned long) (p)))
-
-#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) (p), (ali)))
-
/* align to next higher power-of-2 (except for: 0 => 0, overflow => 0) */
static inline unsigned long ALIGN_POWER2(unsigned long u) {