mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 05:58:05 +02:00
fast_urem_by_const: #ifdef DEBUG an assertion.
util_fast_urem32 is used in the hot path of hashmap lookups and this asserts causes noticeable overhead. The correctness of this code should be well exercised both from testing and mathematical proofs, so gate this assertion behind #ifdef DEBUG. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14168>
This commit is contained in:
parent
c2e6569b46
commit
9f7e57ce98
1 changed files with 2 additions and 0 deletions
|
|
@ -68,7 +68,9 @@ util_fast_urem32(uint32_t n, uint32_t d, uint64_t magic)
|
|||
{
|
||||
uint64_t lowbits = magic * n;
|
||||
uint32_t result = _mul32by64_hi(d, lowbits);
|
||||
#ifdef DEBUG
|
||||
assert(result == n % d);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue