clang-format and clang-tidy fixes for 2ad5420a

This commit is contained in:
github-actions 2021-01-17 20:44:59 +00:00
parent 0e1e441ab3
commit b9cdab9354

View File

@ -5,7 +5,8 @@
* @details To calculate division of two numbers under modulo p * @details To calculate division of two numbers under modulo p
* Modulo operator is not distributive under division, therefore * Modulo operator is not distributive under division, therefore
* we first have to calculate the inverse of divisor using * we first have to calculate the inverse of divisor using
* [Fermat's little theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) * [Fermat's little
theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem)
* Now, we can multiply the dividend with the inverse of divisor * Now, we can multiply the dividend with the inverse of divisor
* and modulo is distributive over multiplication operation. * and modulo is distributive over multiplication operation.
* Let, * Let,
@ -71,7 +72,8 @@ namespace math {
*/ */
uint64_t mod_division(uint64_t a, uint64_t b, uint64_t p) { uint64_t mod_division(uint64_t a, uint64_t b, uint64_t p) {
uint64_t inverse = power(b, p - 2, p) % p; /// Calculate the inverse of b uint64_t inverse = power(b, p - 2, p) % p; /// Calculate the inverse of b
uint64_t result = ((a%p)*(inverse%p))%p; /// Calculate the final result uint64_t result =
((a % p) * (inverse % p)) % p; /// Calculate the final result
return result; return result;
} }
} // namespace modular_division } // namespace modular_division