Skip to content

Commit 688a1e6

Browse files
Manu GoyalManu Goyal
Manu Goyal
authored and
Manu Goyal
committed
Fix compile errors from MSVC
There are still warnings, but these are less important to fix.
1 parent e0eeb90 commit 688a1e6

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

libcuckoo/cuckoohash_map.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,7 @@ public:
24472447

24482448
// Re-size the locks, and set the size to the stored size
24492449
lt.maybe_resize_locks(lt.bucket_count());
2450-
for (spinlock &lock : lt.get_current_locks()) {
2450+
for (auto &lock : lt.get_current_locks()) {
24512451
lock.elem_counter() = 0;
24522452
}
24532453
size_type size;

tests/pcg/pcg_random.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ class extended : public baseclass {
12031203
return baseclass::period_pow2() + table_size*extvalclass::period_pow2();
12041204
}
12051205

1206-
__attribute__((always_inline)) result_type operator()()
1206+
result_type operator()()
12071207
{
12081208
result_type rhs = get_extended_value();
12091209
result_type lhs = this->baseclass::operator()();

tests/pcg/pcg_uint128.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#define PCG_LITTLE_ENDIAN 1
6666
#elif __BIG_ENDIAN__ || _BIG_ENDIAN
6767
#define PCG_LITTLE_ENDIAN 0
68-
#elif __x86_64 || __x86_64__ || __i386 || __i386__
68+
#elif __x86_64 || __x86_64__ || __i386 || __i386__ || _M_IX86 || _M_X64
6969
#define PCG_LITTLE_ENDIAN 1
7070
#elif __powerpc__ || __POWERPC__ || __ppc__ || __PPC__ \
7171
|| __m68k__ || __mc68000__

tests/stress-tests/stress_checked.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <random>
1515
#include <stdexcept>
1616
#include <thread>
17-
#include <unistd.h>
1817
#include <utility>
1918
#include <vector>
2019

@@ -277,7 +276,7 @@ template <class KType> void StressTest(AllEnvironment<KType> *env) {
277276
}
278277
}
279278
// Sleeps before ending the threads
280-
sleep(g_test_len);
279+
std::this_thread::sleep_for(std::chrono::seconds(g_test_len));
281280
env->finished.store(true);
282281
for (size_t i = 0; i < threads.size(); i++) {
283282
threads[i].join();

tests/stress-tests/stress_unchecked.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <random>
1414
#include <stdint.h>
1515
#include <thread>
16-
#include <unistd.h>
1716
#include <utility>
1817
#include <vector>
1918

@@ -168,7 +167,7 @@ void resize_thread(AllEnvironment<KType> *env, size_t thread_seed) {
168167
pcg64_fast gen(thread_seed);
169168
// Resizes at a random time
170169
const size_t sleep_time = gen() % g_test_len;
171-
sleep(sleep_time);
170+
std::this_thread::sleep_for(std::chrono::seconds(sleep_time));
172171
if (env->finished.load()) {
173172
return;
174173
}
@@ -188,7 +187,7 @@ void iterator_thread(AllEnvironment<KType> *env, size_t thread_seed) {
188187
pcg64_fast gen(thread_seed);
189188
// Runs an iteration operation at a random time
190189
const size_t sleep_time = gen() % g_test_len;
191-
sleep(sleep_time);
190+
std::this_thread::sleep_for(std::chrono::seconds(sleep_time));
192191
if (env->finished.load()) {
193192
return;
194193
}
@@ -219,7 +218,7 @@ void clear_thread(AllEnvironment<KType> *env, size_t thread_seed) {
219218
pcg64_fast gen(thread_seed);
220219
// Runs a clear operation at a random time
221220
const size_t sleep_time = gen() % g_test_len;
222-
sleep(sleep_time);
221+
std::this_thread::sleep_for(std::chrono::seconds(sleep_time));
223222
if (env->finished.load()) {
224223
return;
225224
}
@@ -256,7 +255,7 @@ template <class KType> void StressTest(AllEnvironment<KType> *env) {
256255
}
257256
}
258257
// Sleeps before ending the threads
259-
sleep(g_test_len);
258+
std::this_thread::sleep_for(std::chrono::seconds(g_test_len));
260259
env->finished.store(true);
261260
for (size_t i = 0; i < threads.size(); i++) {
262261
threads[i].join();

tests/unit-tests/test_resize.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ TEST_CASE("reserve calc", "[resize]") {
4444
2500000 * slot_per_bucket) == 22);
4545

4646
REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>(
47-
(1UL << 31) * slot_per_bucket) == 31);
47+
(1ULL << 31) * slot_per_bucket) == 31);
4848
REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>(
49-
((1UL << 31) + 1) * slot_per_bucket) == 32);
49+
((1ULL << 31) + 1) * slot_per_bucket) == 32);
5050

5151
REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>(
52-
(1UL << 61) * slot_per_bucket) == 61);
52+
(1ULL << 61) * slot_per_bucket) == 61);
5353
REQUIRE(UnitTestInternalAccess::reserve_calc<IntIntTable>(
5454
((1ULL << 61) + 1) * slot_per_bucket) == 62);
5555
}

0 commit comments

Comments
 (0)