[Bf-blender-cvs] [394318da74e] master: BLI: fix some integer conversions

Jacques Lucke noreply at git.blender.org
Fri Sep 13 10:39:44 CEST 2019


Commit: 394318da74e5fddf14e19d7129a6d8406b67eb34
Author: Jacques Lucke
Date:   Fri Sep 13 10:39:20 2019 +0200
Branches: master
https://developer.blender.org/rB394318da74e5fddf14e19d7129a6d8406b67eb34

BLI: fix some integer conversions

===================================================================

M	source/blender/blenlib/BLI_allocator.h

===================================================================

diff --git a/source/blender/blenlib/BLI_allocator.h b/source/blender/blenlib/BLI_allocator.h
index 77506aa3dc5..fd8c94eee4c 100644
--- a/source/blender/blenlib/BLI_allocator.h
+++ b/source/blender/blenlib/BLI_allocator.h
@@ -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;
   }



More information about the Bf-blender-cvs mailing list