diff options
author | Brian <[email protected]> | 2007-12-11 09:13:12 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-12-11 09:13:12 -0700 |
commit | 4a4543f5360b5f0a3350d9db770f1325cc3a9e84 (patch) | |
tree | 26c6d7c0300cb3b638ed3e843fde2015a98d977c /src/mesa/pipe/p_util.h | |
parent | 23ca30e24bbc8390127910c64da4a321ae63ce3a (diff) |
Fix align16() function to work with 32/64-bit pointers on big-endian.
Diffstat (limited to 'src/mesa/pipe/p_util.h')
-rw-r--r-- | src/mesa/pipe/p_util.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h index b4d1195c9b0..e6d284d9327 100644 --- a/src/mesa/pipe/p_util.h +++ b/src/mesa/pipe/p_util.h @@ -169,13 +169,25 @@ align_free(void *ptr) static INLINE void * align16( void *unaligned ) { - union { - void *p; - uint64 u; - } pu; - pu.p = unaligned; - pu.u = (pu.u + 15) & ~15; - return pu.p; + if (sizeof(void *) == 64) { + union { + void *p; + uint64 u; + } pu; + pu.p = unaligned; + pu.u = (pu.u + 15) & ~15; + return pu.p; + } + else { + /* 32-bit pointers */ + union { + void *p; + uint u; + } pu; + pu.p = unaligned; + pu.u = (pu.u + 15) & ~15; + return pu.p; + } } |