in src/ristretto255.js [197:210]
function invmodL(invX, x) {
for (let i = 0; i < 32; i++) invX[i] = x[i];
for (let i = 251; i >= 0; i--) {
// squaring
SmodL(invX, invX);
// parsing the bits of the modulus
// i & 0x07 == i % 8
// i >> 3 == i / 8 (integer division)
if (((LSub2[i >> 3] >> (i & 0x07)) & 1) !== 0) {
// multiply by x
MmodL(invX, invX, x);
}
}
}