xtensa-esp32-elf/lib/gcc/xtensa-esp32-elf/5.2.0/plugin/include/hash-table.h
/* Return X % Y using multiplicative inverse values INV and SHIFT.

   The multiplicative inverses computed above are for 32-bit types,
   and requires that we be able to compute a highpart multiply.

   FIX: I am not at all convinced that
     3 loads, 2 multiplications, 3 shifts, and 3 additions
   will be faster than
     1 load and 1 modulus
   on modern systems running a compiler.  */
Return X % Y using multiplicative inverse values INV and SHIFT.
The multiplicative inverses computed above are for 32-bit types,
and requires that we be able to compute a highpart multiply.

I am not at all convinced that
3 loads, 2 multiplications, 3 shifts, and 3 additions
will be faster than
1 load and 1 modulus
on modern systems running a compiler.
Return X % Y using multiplicative inverse values INV and SHIFT . The multiplicative inverses computed above are for 32 - bit types and requires that we be able to compute a highpart multiply . I am not at all convinced that 3 loads 2 multiplications 3 shifts and 3 additions will be faster than 1 load and 1 modulus on modern systems running a compiler .
inline hashval_t
mul_mod (hashval_t x, hashval_t y, hashval_t inv, int shift)
{
   hashval_t t1, t2, t3, t4, q, r;
   t1 = ((uint64_t)x * inv) >> 32;
   t2 = x - t1;
   t3 = t2 >> 1;
   t4 = t1 + t3;
   q  = t4 >> shift;
   r  = x - (q * y);
   return r;
}
inline hashval_t mul_mod ( hashval_t x , hashval_t y , hashval_t inv , int shift ) { hashval_t t1 , t2 , t3 , t4 , q , r ; t1 = ( ( uint64_t ) x * inv ) >> 32 ; t2 = x - t1 ; t3 = t2 >> 1 ; t4 = t1 + t3 ; q = t4 >> shift ; r = x - ( q * y ) ; return r ; }
Return X % Y using multiplicative inverse values INV and SHIFT.
Return X % Y using multiplicative inverse values INV and SHIFT .