From d25c429c8d9d8a27badca482be4ea33c525200e2 Mon Sep 17 00:00:00 2001 From: Tomas Valla Date: Mon, 17 Jan 2005 19:41:30 +0000 Subject: [PATCH] useful macro to align pointer p to size s --- lib/lib.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/lib.h b/lib/lib.h index 80857c9c..07c66e9e 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -22,6 +22,7 @@ #define OFFSETOF(s, i) ((unsigned int)&((s *)0)->i) #define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i))) #define ALIGN(s, a) (((s)+a-1)&~(a-1)) +#define ALIGN_PTR(p, s) ((typeof(p)) ((addr_int_t)(p) + (s) - (addr_int_t)(p) % (s))) #define UNALIGNED_PART(ptr, type) (((long) (ptr)) % sizeof(type)) /* Some other macros */ -- 2.39.2