Coverage Report

Created: 2023-06-07 07:00

/src/botan/build/include/botan/internal/prefetch.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* (C) 2023 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#ifndef BOTAN_PREFETCH_UTILS_H_
8
#define BOTAN_PREFETCH_UTILS_H_
9
10
#include <botan/types.h>
11
#include <type_traits>
12
13
namespace Botan {
14
15
/**
16
* Prefetch an array
17
*
18
* This function returns a uint64_t which is accumulated from values
19
* read from the array. This may help confuse the compiler sufficiently
20
* to not elide otherwise "useless" reads. The return value will always
21
* be zero.
22
*/
23
uint64_t prefetch_array_raw(size_t bytes, const void* array) noexcept;
24
25
/**
26
* Prefetch several arrays
27
*
28
* This function returns a uint64_t which is accumulated from values
29
* read from the array. This may help confuse the compiler sufficiently
30
* to not elide otherwise "useless" reads. The return value will always
31
* be zero.
32
*/
33
template <typename T, size_t... Ns>
34
T prefetch_arrays(T (&... arr)[Ns]) noexcept
35
   requires std::is_integral<T>::value
36
0
{
37
0
   return (static_cast<T>(prefetch_array_raw(sizeof(T) * Ns, arr)) & ...);
38
0
}
Unexecuted instantiation: unsigned char const Botan::prefetch_arrays<unsigned char const, 256ul, 256ul, 256ul, 256ul>(unsigned char const (&) [256ul], unsigned char const (&) [256ul], unsigned char const (&) [256ul], unsigned char const (&) [256ul])
Unexecuted instantiation: unsigned char const Botan::prefetch_arrays<unsigned char const, 256ul, 256ul>(unsigned char const (&) [256ul], unsigned char const (&) [256ul])
39
40
}  // namespace Botan
41
42
#endif