util: Add a helper for faster remainders
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 29 Mar 2019 14:08:17 +0000 (15:08 +0100)
committerConnor Abbott <cwabbott0@gmail.com>
Fri, 31 May 2019 17:14:27 +0000 (19:14 +0200)
commitb87817871b615af960c2d84e35d41b88602c4186
tree519a15d65aada0f193a5bcdbc1adfe2d6b4817df
parent983b001c77c6c9e9aa436c3252fafe34edfe6738
util: Add a helper for faster remainders

This should be at least as fast as using fast_idiv_by_const, and has the
advantage that the precomputation is simple enough to be evaluated at
Mesa-compile time for hash tables and sets which have a fixed table of
possible divisors.

Acked-by: Eric Anholt <eric@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
meson.build
src/util/fast_urem_by_const.h [new file with mode: 0644]
src/util/meson.build
src/util/tests/fast_urem_by_const/fast_urem_by_const_test.cpp [new file with mode: 0644]
src/util/tests/fast_urem_by_const/meson.build [new file with mode: 0644]