mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 22:28:04 +02:00
util/math: Add ROUND_DOWN_TO_NPOT
The default ROUND_DOWN_TO only handles POT alignment values, so an additional variant was added which handles NPOT alignment too. Signed-off-by: Dhruv Mark Collins <mark@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37802>
This commit is contained in:
parent
fac705ab8a
commit
dde478ce98
1 changed files with 6 additions and 0 deletions
|
|
@ -705,6 +705,12 @@ ROUND_DOWN_TO(uint64_t value, uint32_t alignment)
|
|||
return ((value) & ~(uint64_t)(alignment - 1));
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ROUND_DOWN_TO_NPOT(uint64_t value, uint32_t alignment)
|
||||
{
|
||||
return value - (value % alignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Align a value, only works pot alignemnts.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue