| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zorin_d_ruler/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstdint> | ||
| 4 | |||
| 5 | #include "zorin_d_ruler/common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace zorin_d_ruler { | ||
| 8 | |||
| 9 | namespace { | ||
| 10 | |||
| 11 | 24 | inline std::int64_t DoHeavyWork(int n) { | |
| 12 | std::int64_t acc = 0; | ||
| 13 |
2/2✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 24 times.
|
1304 | for (int i = 0; i < n; ++i) { |
| 14 |
2/2✓ Branch 0 taken 100800 times.
✓ Branch 1 taken 1280 times.
|
102080 | for (int j = 0; j < n; ++j) { |
| 15 |
2/2✓ Branch 0 taken 9008000 times.
✓ Branch 1 taken 100800 times.
|
9108800 | for (int k = 0; k < n; ++k) { |
| 16 | 9008000 | acc += (static_cast<std::int64_t>(i) * 31) + (static_cast<std::int64_t>(j) * 17) + | |
| 17 | 9008000 | (static_cast<std::int64_t>(k) * 13); | |
| 18 | 9008000 | acc ^= (acc << 1); | |
| 19 | 9008000 | acc += (acc >> 3); | |
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | 24 | return acc; | |
| 24 | } | ||
| 25 | |||
| 26 | } // namespace | ||
| 27 | |||
| 28 | 24 | ZorinDRulerSEQ::ZorinDRulerSEQ(const InType &in) { | |
| 29 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 30 | 24 | GetInput() = in; | |
| 31 | GetOutput() = 0; | ||
| 32 | 24 | } | |
| 33 | |||
| 34 | 24 | bool ZorinDRulerSEQ::ValidationImpl() { | |
| 35 | 24 | return GetInput() > 0; | |
| 36 | } | ||
| 37 | |||
| 38 | 24 | bool ZorinDRulerSEQ::PreProcessingImpl() { | |
| 39 | 24 | GetOutput() = 0; | |
| 40 | 24 | return true; | |
| 41 | } | ||
| 42 | |||
| 43 | 24 | bool ZorinDRulerSEQ::RunImpl() { | |
| 44 | 24 | const int n = GetInput(); | |
| 45 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if (n <= 0) { |
| 46 | return false; | ||
| 47 | } | ||
| 48 | |||
| 49 | 24 | const std::int64_t w = DoHeavyWork(n); | |
| 50 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if (w == -1) { |
| 51 | ✗ | GetOutput() = -1; | |
| 52 | ✗ | return false; | |
| 53 | } | ||
| 54 | |||
| 55 | 24 | GetOutput() = n; | |
| 56 | 24 | return true; | |
| 57 | } | ||
| 58 | |||
| 59 | 24 | bool ZorinDRulerSEQ::PostProcessingImpl() { | |
| 60 | 24 | GetOutput() = GetInput(); | |
| 61 | 24 | return true; | |
| 62 | } | ||
| 63 | |||
| 64 | } // namespace zorin_d_ruler | ||
| 65 |