[UNTESTED] small fixes for consistency

This commit is contained in:
2026-01-02 07:32:09 -05:00
parent ffd5ce5b12
commit 00011f7c88

View File

@@ -3,9 +3,11 @@
#include <array>
#include <atomic>
#include <bit>
#include <cstddef>
#include <cstdint>
#include <new>
#include <utility>
namespace THWeaver {
@@ -141,7 +143,8 @@ public:
"Thread ID out of bounds");
in_queues[thread_id].flush();
hint.fetch_and(~(1 << thread_id), std::memory_order_relaxed);
hint.fetch_and(~(BitmapType(1) << thread_id),
std::memory_order_relaxed);
}
void flush_all() noexcept {
@@ -158,7 +161,7 @@ public:
"Thread ID out of bounds");
return static_cast<FanInFabricSendResult>(static_cast<uint32_t>(
in_queues[thread_id].send(message)));
in_queues[thread_id].send(std::move(message))));
}
FanInFabricRecvBitmapResult
@@ -178,7 +181,7 @@ public:
std::size_t qsize = ((tail + QSIZE_MASK) - head) & QSIZE_MASK;
if (qsize <= 1)
hint.fetch_and(~(1 << hinted_id),
hint.fetch_and(~(BitmapType(1) << hinted_id),
std::memory_order_relaxed);
if (qsize) {
@@ -205,7 +208,7 @@ public:
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
if (qsize <= 1)
hint.fetch_and(~(1 << hinted_id),
hint.fetch_and(~(BitmapType(1) << hinted_id),
std::memory_order_relaxed);
if (qsize) {
@@ -241,7 +244,7 @@ public:
((tail + QSIZE_MASK) - head) & QSIZE_MASK;
if (qsize <= 1)
hint.fetch_and(~(1 << hinted_id),
hint.fetch_and(~(BitmapType(1) << hinted_id),
std::memory_order_relaxed);
if (qsize) {
@@ -274,15 +277,15 @@ public:
uint8_t curr = dl.first;
if (in_queues[curr].size())
bitmap |= 1 << curr;
bitmap |= BitmapType(1) << curr;
do {
curr = dl.next[curr];
if (in_queues[curr].size())
bitmap |= 1 << curr;
bitmap |= BitmapType(1) << curr;
} while (curr != dl.last);
hint.fetch_or(bitmap, std::memory_order_release);
hint.fetch_or(bitmap, std::memory_order_relaxed);
}
template <std::size_t thread_id> std::size_t size() const noexcept {