[pipe]: add Offset() util macro
authorkeithw <keithw@keithw-laptop.(none)>
Wed, 21 Nov 2007 11:04:20 +0000 (11:04 +0000)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Sun, 9 Dec 2007 14:03:33 +0000 (14:03 +0000)
src/mesa/pipe/p_util.h

index 7897bc9..4002e26 100644 (file)
@@ -114,6 +114,7 @@ REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
 #define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
 
 #define Elements(x) sizeof(x)/sizeof(*(x))
+#define Offset(TYPE, MEMBER) ((unsigned)&(((TYPE *)NULL)->MEMBER))
 
 /**
  * Return a pointer aligned to next multiple of 16 bytes.