GCC Code Coverage Report


Directory: ./
File: tasks/dergynov_s_radix_sort_double_simple_merge/common/include/common.hpp
Date: 2026-02-23 23:20:07
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 0 0 -%
Branches: 4 4 100.0%

Line Branch Exec Source
1 #pragma once
2
3 #include <cstdint>
4 #include <cstring>
5 #include <string>
6 #include <tuple>
7 #include <vector>
8
9 #include "task/include/task.hpp"
10
11 namespace dergynov_s_radix_sort_double_simple_merge {
12
13 using InType = std::vector<double>;
14 using OutType = std::tuple<std::vector<double>, int>;
15 using TestType = std::tuple<std::tuple<std::vector<double>, std::vector<double>>, std::string>;
16 using BaseTask = ppc::task::Task<InType, OutType>;
17
18 inline uint64_t DoubleToSortableUint64(double d) {
19 uint64_t u = 0;
20 std::memcpy(&u, &d, sizeof(double));
21
2/2
✓ Branch 0 taken 81 times.
✓ Branch 1 taken 177 times.
258 if ((u & 0x8000000000000000ULL) != 0U) {
22 81 u = ~u;
23 } else {
24 177 u |= 0x8000000000000000ULL;
25 }
26 return u;
27 }
28
29 inline double SortableUint64ToDouble(uint64_t u) {
30
2/2
✓ Branch 0 taken 177 times.
✓ Branch 1 taken 81 times.
258 if ((u & 0x8000000000000000ULL) != 0U) {
31 177 u &= ~0x8000000000000000ULL;
32 } else {
33 81 u = ~u;
34 }
35 double d = 0.0;
36 std::memcpy(&d, &u, sizeof(double));
37 return d;
38 }
39
40 } // namespace dergynov_s_radix_sort_double_simple_merge
41