diff options
author | Jason Ekstrand <[email protected]> | 2020-02-07 04:33:19 -0600 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-07 04:51:29 +0000 |
commit | faea84e2540810feb66ac88359b50cf69f2b3cc6 (patch) | |
tree | 25d9d9e794e254df4cfd2cef4b6f496ab12f9b17 /src/intel/vulkan/anv_private.h | |
parent | 61ac8cf08381f7df05b477cfc6854b3b4b88f03f (diff) |
anv: Add an align_down_u32 helper
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3777>
Diffstat (limited to 'src/intel/vulkan/anv_private.h')
-rw-r--r-- | src/intel/vulkan/anv_private.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index cdfbcb87535..8138137abf7 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -232,10 +232,17 @@ align_down_npot_u32(uint32_t v, uint32_t a) } static inline uint32_t +align_down_u32(uint32_t v, uint32_t a) +{ + assert(a != 0 && a == (a & -a)); + return v & ~(a - 1); +} + +static inline uint32_t align_u32(uint32_t v, uint32_t a) { assert(a != 0 && a == (a & -a)); - return (v + a - 1) & ~(a - 1); + return align_down_u32(v + a - 1, a); } static inline uint64_t |