diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/macros.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index c3ef42a4282..ed207d44a64 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -698,6 +698,16 @@ ALIGN(uintptr_t value, int32_t alignment) } /** + * Like ALIGN(), but works with a non-power-of-two alignment. + */ +static inline uintptr_t +ALIGN_NPOT(uintptr_t value, int32_t alignment) +{ + assert(alignment > 0); + return (value + alignment - 1) / alignment * alignment; +} + +/** * Align a value down to an alignment value * * If \c value is not already aligned to the requested alignment value, it |