GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 9 / 0 / 9
Functions: 100.0% 2 / 1 / 3
Branches: 83.3% 10 / 0 / 12

src/math/safe_mod/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../../util/traits/math/lib.hpp"
4
5 namespace tifa_libs {
6
7 template <int_c T>
8 6274019032 CEXP T safe_mod(T x, to_uint_t<T> mod) NE {
9 if CEXP (sint_c<T>) {
10
6/8
int tifa_libs::safe_mod<int>(int, tifa_libs::to_uint<int>::type):
✓ Branch 0 taken 1447271713 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1447271713 times.
long tifa_libs::safe_mod<long>(long, tifa_libs::to_uint<long>::type):
✓ Branch 0 taken 920114153 times.
✓ Branch 1 taken 3435 times.
✓ Branch 2 taken 7439 times.
✓ Branch 3 taken 920106714 times.
6274019032 if (x <= -(T)mod || x >= (T)mod) x %= (T)mod;
11
4/4
int tifa_libs::safe_mod<int>(int, tifa_libs::to_uint<int>::type):
✓ Branch 0 taken 722462610 times.
✓ Branch 1 taken 724809103 times.
long tifa_libs::safe_mod<long>(long, tifa_libs::to_uint<long>::type):
✓ Branch 0 taken 285535078 times.
✓ Branch 1 taken 634582510 times.
6274019032 retif_((x < 0), x + (T)mod, x);
12 } else {
13 retif_((x >= mod), x % mod, x);
14 }
15 }
16
17 } // namespace tifa_libs
18