moduloPrimeIndex

Undocumented in source. Be warned that the author may not have intended to support it.
pure nothrow @safe @nogc
size_t
moduloPrimeIndex
(
in size_t value
,)

Examples

static assert(primeConstants.length == 187);
assert(moduloPrimeIndex(8, PrimeIndex(3)) == 3); // modulo 5
assert(moduloPrimeIndex(9, PrimeIndex(4)) == 2); // modulo 7

verify moduloPrimeIndex

static assert(primeConstants.length <= PrimeIndex._ix.max);
foreach (const primeIndex, const prime; primeConstants)
{
	if (prime != 0)
	{
		assert(moduloPrimeIndex(prime + 0, PrimeIndex(cast(typeof(PrimeIndex._ix))primeIndex)) == 0);
		assert(moduloPrimeIndex(prime + 1, PrimeIndex(cast(typeof(PrimeIndex._ix))primeIndex)) == 1);
	}
}

Meta