Commit c2d81c6 1 parent e688ada commit c2d81c6 Copy full SHA for c2d81c6
File tree 3 files changed +10
-10
lines changed
bad_speculation/lookup_tables_1
memory_bound/swmem_prefetch_1
3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1
1
#include " solution.hpp"
2
2
3
- static size_t mapToBucket (size_t v) { // diff
3
+ static std:: size_t mapToBucket (std:: size_t v) { // diff
4
4
if (v >= 0 && v < 13 ) return 0 ; // 13
5
5
else if (v >= 13 && v < 29 ) return 1 ; // 16
6
6
else if (v >= 29 && v < 41 ) return 2 ; // 12
@@ -11,8 +11,8 @@ static size_t mapToBucket(size_t v) { // diff
11
11
return -1 ; // let it crash
12
12
}
13
13
14
- std::array<size_t , NUM_BUCKETS> histogram (const std::vector<int > &values) {
15
- std::array<size_t , NUM_BUCKETS> retBuckets{0 };
14
+ std::array<std:: size_t , NUM_BUCKETS> histogram (const std::vector<int > &values) {
15
+ std::array<std:: size_t , NUM_BUCKETS> retBuckets{0 };
16
16
for (auto v : values) {
17
17
retBuckets[mapToBucket (v)]++;
18
18
}
Original file line number Diff line number Diff line change 1
1
#include < array>
2
2
#include < vector>
3
3
4
- constexpr size_t NUM_BUCKETS = 7 ;
5
- constexpr size_t NUM_VALUES = 1024 * 1024 ;
4
+ constexpr std:: size_t NUM_BUCKETS = 7 ;
5
+ constexpr std:: size_t NUM_VALUES = 1024 * 1024 ;
6
6
7
7
void init (std::vector<int > &values);
8
- std::array<size_t , NUM_BUCKETS> histogram (const std::vector<int > &values);
8
+ std::array<std:: size_t , NUM_BUCKETS> histogram (const std::vector<int > &values);
Original file line number Diff line number Diff line change 1
1
#include < vector>
2
2
#include < limits>
3
3
4
- static constexpr size_t HASH_MAP_SIZE = 32 * 1024 * 1024 - 5 ;
5
- static constexpr size_t NUMBER_OF_LOOKUPS = 1024 * 1024 ;
4
+ static constexpr std:: size_t HASH_MAP_SIZE = 32 * 1024 * 1024 - 5 ;
5
+ static constexpr std:: size_t NUMBER_OF_LOOKUPS = 1024 * 1024 ;
6
6
7
7
class hash_map_t {
8
8
static constexpr int UNUSED = std::numeric_limits<int >::max();
9
9
std::vector<int > m_vector;
10
- size_t N_Buckets;
10
+ std:: size_t N_Buckets;
11
11
public:
12
- hash_map_t (size_t size) : m_vector(size, UNUSED), N_Buckets(size) {}
12
+ hash_map_t (std:: size_t size) : m_vector(size, UNUSED), N_Buckets(size) {}
13
13
14
14
bool insert (int val) {
15
15
int bucket = val % N_Buckets;
You can’t perform that action at this time.
0 commit comments