Coverage Report

Created: 2025-07-18 06:03

/src/highwayhash/highwayhash/highwayhash_target.cc
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2017 Google Inc. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
// WARNING: this is a "restricted" source file; avoid including any headers
16
// unless they are also restricted. See arch_specific.h for details.
17
18
#include "highwayhash/highwayhash_target.h"
19
20
#include "highwayhash/highwayhash.h"
21
22
#ifndef HH_DISABLE_TARGET_SPECIFIC
23
namespace highwayhash {
24
25
extern "C" {
26
uint64_t HH_ADD_TARGET_SUFFIX(HighwayHash64_)(const HHKey key,
27
                                              const char* bytes,
28
0
                                              const uint64_t size) {
29
0
  HHStateT<HH_TARGET> state(key);
30
0
  HHResult64 result;
31
0
  HighwayHashT(&state, bytes, size, &result);
32
0
  return result;
33
0
}
Unexecuted instantiation: HighwayHash64_Portable
Unexecuted instantiation: HighwayHash64_AVX2
Unexecuted instantiation: HighwayHash64_SSE41
34
}  // extern "C"
35
36
template <TargetBits Target>
37
void HighwayHash<Target>::operator()(const HHKey& key,
38
                                     const char* HH_RESTRICT bytes,
39
                                     const size_t size,
40
49
                                     HHResult64* HH_RESTRICT hash) const {
41
49
  HHStateT<Target> state(key);
42
49
  HighwayHashT(&state, bytes, size, hash);
43
49
}
Unexecuted instantiation: highwayhash::HighwayHash<1u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long*) const
highwayhash::HighwayHash<4u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long*) const
Line
Count
Source
40
49
                                     HHResult64* HH_RESTRICT hash) const {
41
49
  HHStateT<Target> state(key);
42
49
  HighwayHashT(&state, bytes, size, hash);
43
49
}
Unexecuted instantiation: highwayhash::HighwayHash<2u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long*) const
44
45
template <TargetBits Target>
46
void HighwayHash<Target>::operator()(const HHKey& key,
47
                                     const char* HH_RESTRICT bytes,
48
                                     const size_t size,
49
0
                                     HHResult128* HH_RESTRICT hash) const {
50
0
  HHStateT<Target> state(key);
51
0
  HighwayHashT(&state, bytes, size, hash);
52
0
}
Unexecuted instantiation: highwayhash::HighwayHash<1u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [2]) const
Unexecuted instantiation: highwayhash::HighwayHash<4u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [2]) const
Unexecuted instantiation: highwayhash::HighwayHash<2u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [2]) const
53
54
template <TargetBits Target>
55
void HighwayHash<Target>::operator()(const HHKey& key,
56
                                     const char* HH_RESTRICT bytes,
57
                                     const size_t size,
58
0
                                     HHResult256* HH_RESTRICT hash) const {
59
0
  HHStateT<Target> state(key);
60
0
  HighwayHashT(&state, bytes, size, hash);
61
0
}
Unexecuted instantiation: highwayhash::HighwayHash<1u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [4]) const
Unexecuted instantiation: highwayhash::HighwayHash<4u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [4]) const
Unexecuted instantiation: highwayhash::HighwayHash<2u>::operator()(unsigned long const (&) [4], char const*, unsigned long, unsigned long (*) [4]) const
62
63
template <TargetBits Target>
64
void HighwayHashCat<Target>::operator()(const HHKey& key,
65
                                        const StringView* HH_RESTRICT fragments,
66
                                        const size_t num_fragments,
67
0
                                        HHResult64* HH_RESTRICT hash) const {
68
0
  HighwayHashCatT<Target> cat(key);
69
0
  for (size_t i = 0; i < num_fragments; ++i) {
70
0
    cat.Append(fragments[i].data, fragments[i].num_bytes);
71
0
  }
72
0
  cat.Finalize(hash);
73
0
}
Unexecuted instantiation: highwayhash::HighwayHashCat<1u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long*) const
Unexecuted instantiation: highwayhash::HighwayHashCat<4u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long*) const
Unexecuted instantiation: highwayhash::HighwayHashCat<2u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long*) const
74
75
template <TargetBits Target>
76
void HighwayHashCat<Target>::operator()(const HHKey& key,
77
                                        const StringView* HH_RESTRICT fragments,
78
                                        const size_t num_fragments,
79
0
                                        HHResult128* HH_RESTRICT hash) const {
80
0
  HighwayHashCatT<Target> cat(key);
81
0
  for (size_t i = 0; i < num_fragments; ++i) {
82
0
    cat.Append(fragments[i].data, fragments[i].num_bytes);
83
0
  }
84
0
  cat.Finalize(hash);
85
0
}
Unexecuted instantiation: highwayhash::HighwayHashCat<1u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [2]) const
Unexecuted instantiation: highwayhash::HighwayHashCat<4u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [2]) const
Unexecuted instantiation: highwayhash::HighwayHashCat<2u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [2]) const
86
87
template <TargetBits Target>
88
void HighwayHashCat<Target>::operator()(const HHKey& key,
89
                                        const StringView* HH_RESTRICT fragments,
90
                                        const size_t num_fragments,
91
0
                                        HHResult256* HH_RESTRICT hash) const {
92
0
  HighwayHashCatT<Target> cat(key);
93
0
  for (size_t i = 0; i < num_fragments; ++i) {
94
0
    cat.Append(fragments[i].data, fragments[i].num_bytes);
95
0
  }
96
0
  cat.Finalize(hash);
97
0
}
Unexecuted instantiation: highwayhash::HighwayHashCat<1u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [4]) const
Unexecuted instantiation: highwayhash::HighwayHashCat<4u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [4]) const
Unexecuted instantiation: highwayhash::HighwayHashCat<2u>::operator()(unsigned long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long (*) [4]) const
98
99
// Instantiate for the current target.
100
template struct HighwayHash<HH_TARGET>;
101
template struct HighwayHashCat<HH_TARGET>;
102
103
}  // namespace highwayhash
104
#endif  // HH_DISABLE_TARGET_SPECIFIC