GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 6 / 0 / 6
Functions: 100.0% 2 / 0 / 2
Branches: 100.0% 4 / 0 / 4

src/math/mul_mod/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../safe_mod/lib.hpp"
4
5 namespace tifa_libs {
6
7 3680995596 CEXP i64 mul_mod_s(i64 a, i64 b, u64 mod) NE {
8
2/2
✓ Branch 4 taken 3680995481 times.
✓ Branch 5 taken 115 times.
3680995596 if (std::bit_width((u64)abs(a)) + std::bit_width((u64)abs(b)) < 64) return safe_mod(a * b % (i64)mod, mod);
9 115 return safe_mod((i64)((i128)a * b % mod), mod);
10 }
11 24012336890 CEXP u64 mul_mod_u(u64 a, u64 b, u64 mod) NE {
12
2/2
✓ Branch 2 taken 18036376256 times.
✓ Branch 3 taken 5975960634 times.
24012336890 if (std::bit_width(a) + std::bit_width(b) <= 64) return a * b % mod;
13 5975960634 return (u64)((u128)a * b % mod);
14 }
15
16 } // namespace tifa_libs
17