diff --git a/include/weaver.h b/include/weaver.h index 41fa753..be6d77d 100644 --- a/include/weaver.h +++ b/include/weaver.h @@ -3,9 +3,11 @@ #include #include +#include #include #include #include +#include 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(static_cast( - 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 size() const noexcept {