Use uintptr_t instead of size_t, since size_t is not guaranteed to be pointer-sized.
This commit is contained in:
committed by
Keith Winstein
parent
0d6875b8be
commit
d867a716b7
@@ -59,13 +59,13 @@ static void * aligned_alloc( int len )
|
||||
if( ! (ptr = malloc(len)) ) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
if( (size_t)ptr & 0xF ) {
|
||||
if( (uintptr_t)ptr & 0xF ) {
|
||||
// The pointer wasn't 16-byte aligned, so try again with valloc
|
||||
free(ptr);
|
||||
if( ! (ptr = valloc(len)) ) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
if( (size_t)ptr & 0xF ) {
|
||||
if( (uintptr_t)ptr & 0xF ) {
|
||||
free(ptr);
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user