aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_allocator.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-07 21:27:55 -0800
committerJason Ekstrand <[email protected]>2016-03-07 22:23:44 -0800
commitf61d40adc2a09221453b7a87880e134a5424773e (patch)
tree083eb2252f2dee7a127d92323fcfc1df28f9e7a5 /src/intel/vulkan/anv_allocator.c
parent3d4f2b0927acaac05e87ed07ae492e39b4c82ff7 (diff)
anv/allocator: Better casting in PFL macros
We cast he constant 0xfff values to a uintptr_t before applying a bitwise negate to ensure that they are actually 64-bit when needed. Also, the count variable doesn't need to be explicitly cast, it will get upcast as needed by the "|" operation.
Diffstat (limited to 'src/intel/vulkan/anv_allocator.c')
-rw-r--r--src/intel/vulkan/anv_allocator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 385c63f9945..4fc83386a71 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -198,9 +198,9 @@ anv_free_list_push(union anv_free_list *list, void *map, int32_t offset)
* means that the bottom 12 bits should all be zero.
*/
#define PFL_COUNT(x) ((uintptr_t)(x) & 0xfff)
-#define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~0xfff))
+#define PFL_PTR(x) ((void *)((uintptr_t)(x) & ~(uintptr_t)0xfff))
#define PFL_PACK(ptr, count) ({ \
- (void *)((uintptr_t)(ptr) | (uintptr_t)((count) & 0xfff)); \
+ (void *)(((uintptr_t)(ptr) & ~(uintptr_t)0xfff) | ((count) & 0xfff)); \
})
static bool