]> mj.ucw.cz Git - libucw.git/commitdiff
fix OFFSET_OF on 64-bit architectures
authorRobert Spalek <rspalek@gmail.com>
Thu, 5 Feb 2009 02:31:03 +0000 (18:31 -0800)
committerRobert Spalek <rspalek@gmail.com>
Thu, 5 Feb 2009 02:31:03 +0000 (18:31 -0800)
ucw/lib.h

index e56cfad1e041a30af3b34ef9cecc7669cb3e3f9a..cae773d9deb89adb0243a3aef81d543144568613 100644 (file)
--- a/ucw/lib.h
+++ b/ucw/lib.h
@@ -20,7 +20,7 @@
 
 #define CHECK_PTR_TYPE(x, type) ((x)-(type)(x) + (type)(x))
 #define PTR_TO(s, i) &((s*)0)->i
-#define OFFSETOF(s, i) ((unsigned int) PTR_TO(s, i))
+#define OFFSETOF(s, i) ((uintptr_t) PTR_TO(s, i))
 #define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
 #define ALIGN_TO(s, a) (((s)+a-1)&~(a-1))
 #define ALIGN_PTR(p, s) ((uintptr_t)(p) % (s) ? (typeof(p))((uintptr_t)(p) + (s) - (uintptr_t)(p) % (s)) : (p))