From: Tomas Valla Date: Tue, 18 Jan 2005 15:45:31 +0000 (+0000) Subject: Wrong alignment fixed. X-Git-Tag: holmes-import~837 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=003ee0b7a4afd149581c1609bc56ad7dfb5f20a4;p=libucw.git Wrong alignment fixed. --- diff --git a/lib/lib.h b/lib/lib.h index 15cad210..f81e3589 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -23,7 +23,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) ( (s)>1 ? ((typeof(p)) ((addr_int_t)(p) + (s) - (addr_int_t)(p) % (s))) : (p) ) +#define ALIGN_PTR(p, s) ((addr_int_t)(p) % (s) ? (typeof(p))((addr_int_t)(p) + (s) - (addr_int_t)(p) % (s)) : (p)) #define UNALIGNED_PART(ptr, type) (((long) (ptr)) % sizeof(type)) /* Some other macros */