Page MenuHomePhabricator

Consolidate all uses of the fast range mapping technique in util/fastrange.h
ClosedPublic

Authored by Fabien on Aug 21 2023, 22:30.

Details

Summary
Several places in the codebase use the fast range mapping technique described in https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/, some for 32-bit ranges, some for 64-bit ones.

Move all of these to util/fastrange.h, and give them a consistent name.

Backport of core#23994.

Test Plan
ninja all check-all
ninja bitcoin-fuzzers

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable