Skip to content

Commit c2d81c6

Browse files
committed
Fixed std::size_t
1 parent e688ada commit c2d81c6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

labs/bad_speculation/lookup_tables_1/solution.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "solution.hpp"
22

3-
static size_t mapToBucket(size_t v) { // diff
3+
static std::size_t mapToBucket(std::size_t v) { // diff
44
if (v >= 0 && v < 13) return 0; // 13
55
else if (v >= 13 && v < 29) return 1; // 16
66
else if (v >= 29 && v < 41) return 2; // 12
@@ -11,8 +11,8 @@ static size_t mapToBucket(size_t v) { // diff
1111
return -1; // let it crash
1212
}
1313

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};
1616
for (auto v : values) {
1717
retBuckets[mapToBucket(v)]++;
1818
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <array>
22
#include <vector>
33

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;
66

77
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);

labs/memory_bound/swmem_prefetch_1/solution.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <vector>
22
#include <limits>
33

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;
66

77
class hash_map_t {
88
static constexpr int UNUSED = std::numeric_limits<int>::max();
99
std::vector<int> m_vector;
10-
size_t N_Buckets;
10+
std::size_t N_Buckets;
1111
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) {}
1313

1414
bool insert(int val) {
1515
int bucket = val % N_Buckets;

0 commit comments

Comments
 (0)