Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 877f607

Browse files
committed
mpsc_queue: replace magic number with expression
1 parent 27c6e04 commit 877f607

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

include/libpmemobj++/experimental/mpsc_queue.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class mpsc_queue {
4646
struct first_block {
4747
static constexpr size_t CAPACITY =
4848
pmem::detail::CACHELINE_SIZE - sizeof(size_t);
49-
static constexpr size_t DIRTY_FLAG = (1ULL << 63);
49+
static constexpr size_t DIRTY_FLAG =
50+
(1ULL << (sizeof(size_t) * 8 - 1));
5051

5152
pmem::obj::p<size_t> size;
5253
char data[CAPACITY];
@@ -267,8 +268,8 @@ mpsc_queue::try_consume_batch(Function &&f)
267268

268269
/* Need to call try_consume twice, as some data may be at the end
269270
* of buffer, and some may be at the beginning. Ringbuffer does not
270-
* merge those two pats into one try_consume. If all data was
271-
* consumed during first try_consume, second would fail. */
271+
* merge those two parts into one try_consume. If all data was
272+
* consumed during first try_consume, second will do nothing. */
272273
for (int i = 0; i < 2; i++) {
273274
size_t offset;
274275
size_t len = ringbuf_consume(ring_buffer.get(), &offset);

0 commit comments

Comments
 (0)