barrettReduce function

int barrettReduce(
  1. int a
)

Implementation

int barrettReduce(int a) {
  // Constant v = floor((1<<26 + KYBER_Q/2) / KYBER_Q) = 20159.
  const int v = 20159;
  int t = ((a * v) >> 26);
  int r = a - t * KYBER_Q;
  return r;
}