From 5f2d469e37aef1de8a127f0541e69285988748d4 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 25 Jun 2015 16:26:07 -0700 Subject: [PATCH] vk: Add func anv_is_aligned() --- src/vulkan/private.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 6693a288866..0d199c836a3 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -72,6 +72,14 @@ ALIGN_I32(int32_t v, int32_t a) return (v + a - 1) & ~(a - 1); } +/** Alignment must be a power of 2. */ +static inline bool +anv_is_aligned(uintmax_t n, uintmax_t a) +{ + assert(a == (a & -a)); + return (n & (a - 1)) == 0; +} + static inline uint32_t anv_minify(uint32_t n, uint32_t levels) { -- 2.30.2