From 4d68c477ad29bc39794eb5f3e5f0886129c6c9c5 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Wed, 6 Jan 2016 15:40:01 -0800 Subject: anv: Assert that alignments are not 0 for align_* Signed-off-by: Jordan Justen --- src/vulkan/anv_private.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/vulkan/anv_private.h') diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 5bd50258c8a..0cd8ab6facd 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -83,18 +83,21 @@ typedef union _VK_LOADER_DATA { static inline uint32_t align_u32(uint32_t v, uint32_t a) { + assert(a != 0 && a == (a & -a)); return (v + a - 1) & ~(a - 1); } static inline uint64_t align_u64(uint64_t v, uint64_t a) { + assert(a != 0 && a == (a & -a)); return (v + a - 1) & ~(a - 1); } static inline int32_t align_i32(int32_t v, int32_t a) { + assert(a != 0 && a == (a & -a)); return (v + a - 1) & ~(a - 1); } -- cgit v1.2.3