mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
Fix align16() function to work with 32/64-bit pointers on big-endian.
This commit is contained in:
parent
23ca30e24b
commit
4a4543f536
1 changed files with 19 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue