From: Chad Versace Date: Thu, 25 Jun 2015 23:26:07 +0000 (-0700) Subject: vk: Add func anv_is_aligned() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f2d469e37aef1de8a127f0541e69285988748d4;p=mesa.git vk: Add func anv_is_aligned() --- 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) {