Skip to content

Commit 4577163

Browse files
committed
Better Win32/x86 support
1 parent dc8cb4c commit 4577163

4 files changed

Lines changed: 14 additions & 15 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22

33
project(seq
4-
VERSION 2.2
4+
VERSION 2.3
55
DESCRIPTION "Collection of C++17 original containers"
66
HOMEPAGE_URL "https://github.com/Thermadiag/seq"
77
LANGUAGES CXX

seq/concurrent_queue.hpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ namespace seq
8686
// Bucket structure, stores up to count elements
8787
struct Bucket : BaseBucket
8888
{
89-
atomic_type cnt{ mask_full }; // Mask of created (constructed) elements
90-
atomic_type pop{ 0 }; // Mask of poped (removed) elements
91-
RawStorage<T, count> values; // Elements
89+
atomic_type cnt{ mask_full }; // Mask of created (constructed) elements
90+
atomic_type pop{ 0 }; // Mask of poped (removed) elements
91+
RawStorage<T, count> values; // Elements
9292

9393
// Return bitmask of valid elements
9494
size_type valid_mask() const noexcept { return cnt.load(std::memory_order_relaxed) & (~pop.load(std::memory_order_relaxed)); }
@@ -116,12 +116,11 @@ namespace seq
116116
};
117117

118118
private:
119-
120119
static constexpr std::size_t cache_line_size = 64;
121120

122-
alignas(cache_line_size) atomic_type d_head{ 0 };// Head (insert) position
123-
alignas(cache_line_size) atomic_type d_tail{ 0 };// Tail (pop) position
124-
alignas(cache_line_size) BaseBucket d_end; // End bucket of linked list
121+
alignas(cache_line_size) atomic_type d_head{ 0 }; // Head (insert) position
122+
alignas(cache_line_size) atomic_type d_tail{ 0 }; // Tail (pop) position
123+
alignas(cache_line_size) BaseBucket d_end; // End bucket of linked list
125124

126125
// Free list of buckets
127126
atomic_bucket d_free{ nullptr };
@@ -285,7 +284,7 @@ namespace seq
285284
continue;
286285

287286
// Retrieve/destroy value
288-
fun(*bucket->values.live_slot(idx));
287+
fun(*bucket->values.live_slot((std::size_t)idx));
289288
// Mark as poped
290289
auto popped = bucket->pop.fetch_or(idx_bits, std::memory_order_acq_rel) | idx_bits;
291290

@@ -330,7 +329,7 @@ namespace seq
330329
}
331330

332331
auto bucket = static_cast<Bucket*>(last);
333-
new (bucket->values.raw_slot(idx)) T(std::move(val));
332+
new (bucket->values.raw_slot((std::size_t)idx)) T(std::move(val));
334333
bucket->cnt.fetch_or(size_type{ 1 } << idx, std::memory_order_release);
335334

336335
// Free potentially reserved bucket.
@@ -413,7 +412,7 @@ namespace seq
413412
SEQ_ALWAYS_INLINE void emplace(Args&&... args)
414413
{
415414
// Create value upfront as this might throw
416-
T val( std::forward<Args>(args)... );
415+
T val(std::forward<Args>(args)...);
417416

418417
// Increment head position, and make sure a bucket is availble if needed BEFORE increment
419418
// to avoid potential bad_alloc exception to corrupt the head state.
@@ -471,7 +470,7 @@ namespace seq
471470
{
472471
auto h = d_head.load(std::memory_order_relaxed);
473472
auto t = d_tail.load(std::memory_order_relaxed);
474-
return h > t ? (h - t) : 0;
473+
return h > t ? static_cast<std::size_t>(h - t) : std::size_t{ 0 };
475474
}
476475
SEQ_ALWAYS_INLINE bool empty() const noexcept { return size() == 0; }
477476
};
@@ -686,7 +685,7 @@ namespace seq
686685
: Allocator(al)
687686
{
688687
concurrent_queue tmp(al);
689-
tmp.reserve(count);
688+
tmp.reserve((size_t)count);
690689
d_data.store(tmp.d_data.exchange(nullptr));
691690
}
692691

seq/hash.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ namespace seq
7878
a ^= a >> 23;
7979
a *= 0x2127599bf4325c37ULL;
8080
a ^= a >> 47;
81-
return a;
81+
return static_cast<std::size_t>(a);
8282
#endif
8383
}
8484

seq/internal/radix_tree.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ namespace seq
11721172
throw;
11731173
}
11741174

1175-
if (capacity > min_capacity && count() <= capacity / 2) {
1175+
if (capacity > min_capacity && count() <= capacity / 2u) {
11761176
// If the following throws, the tree remains in a valid state
11771177

11781178
std::size_t cap = capacity_for_size(count());

0 commit comments

Comments
 (0)