vk: Add anv_minify()

This commit is contained in:
Chad Versace
2015-05-28 09:50:26 -07:00
parent 7cec6c5dfd
commit f7fb7575ef

View File

@@ -72,6 +72,15 @@ ALIGN_I32(int32_t v, int32_t a)
return (v + a - 1) & ~(a - 1);
}
static inline uint32_t
anv_minify(uint32_t n, uint32_t levels)
{
if (unlikely(n == 0))
return 0;
else
return MAX(n >> levels, 1);
}
#define for_each_bit(b, dword) \
for (uint32_t __dword = (dword); \
(b) = __builtin_ffs(__dword) - 1, __dword; \