Bitcoin ABC 0.26.3
P2P Digital Currency
|
#include <cstdint>
Go to the source code of this file.
Functions | |
static uint32_t | FastRange32 (uint32_t x, uint32_t n) |
This file offers implementations of the fast range reduction technique described in https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/. | |
static uint64_t | FastRange64 (uint64_t x, uint64_t n) |
Fast range reduction with 64-bit input and 64-bit range. | |
This file offers implementations of the fast range reduction technique described in https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/.
In short, they take an integer x and a range n, and return the upper bits of (x * n). If x is uniformly distributed over its domain, the result is as close to uniformly distributed over [0, n) as (x mod n) would be, but significantly faster. Fast range reduction with 32-bit input and 32-bit range.
Definition at line 22 of file fastrange.h.