From: Jordan Justen Date: Wed, 6 Jan 2016 23:40:01 +0000 (-0800) Subject: anv: Assert that alignments are not 0 for align_* X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d68c477ad29bc39794eb5f3e5f0886129c6c9c5;p=mesa.git anv: Assert that alignments are not 0 for align_* Signed-off-by: Jordan Justen --- 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); }