GCC Code Coverage Report


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

src/tree/dfs/hash_rooted/lib.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include "../../ds/lib.hpp"
4
5 namespace tifa_libs {
6
7 template <class Hash, u64 OFFSET = 1>
8 17 CEXP vecuu tree_hash_rooted(tree_c auto CR tr, Hash&& hasher) NE {
9 17 vecuu hash(tr.vsize(), OFFSET);
10 9323547 auto dfs = [&](auto&& dfs, u32 u, u32 fa) NE -> void {
11
2/2
✓ Branch 6 taken 9323496 times.
✓ Branch 7 taken 4661765 times.
13985261 for (auto v : tr[u])
12
2/2
✓ Branch 1 taken 4661748 times.
✓ Branch 2 taken 4661748 times.
9323496 if ((u32)v != fa) dfs(dfs, (u32)v, u), hash[u] += hasher(hash[v]);
13 };
14 17 dfs(dfs, tr.root, -1_u32);
15 17 return hash;
16 }
17
18 } // namespace tifa_libs
19