BLI: fix some integer conversions
This commit is contained in:
parent
57e55906f0
commit
394318da74
|
@ -82,13 +82,13 @@ class RawAllocator {
|
|||
|
||||
void *allocate_aligned(uint size, uint alignment, const char *UNUSED(name))
|
||||
{
|
||||
BLI_assert(is_power_of_2_i(alignment));
|
||||
BLI_assert(is_power_of_2_i((int)alignment));
|
||||
void *ptr = malloc(size + alignment + sizeof(MemHead));
|
||||
void *used_ptr = (void *)((uintptr_t)POINTER_OFFSET(ptr, alignment + sizeof(MemHead)) &
|
||||
~((uintptr_t)alignment - 1));
|
||||
uint offset = (uintptr_t)used_ptr - (uintptr_t)ptr;
|
||||
uint offset = (uint)((uintptr_t)used_ptr - (uintptr_t)ptr);
|
||||
BLI_assert(offset >= sizeof(MemHead));
|
||||
((MemHead *)used_ptr - 1)->offset = offset;
|
||||
((MemHead *)used_ptr - 1)->offset = (int)offset;
|
||||
return used_ptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue