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

Commit f35afb8

Browse files
authored
Merge pull request #1164 from lukaszstolarczuk/fixes
Fixes
2 parents 9a42fad + 45a72a9 commit f35afb8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

include/libpmemobj++/persistent_ptr.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: BSD-3-Clause
2-
/* Copyright 2015-2020, Intel Corporation */
2+
/* Copyright 2015-2021, Intel Corporation */
33

44
/**
55
* @file
@@ -576,7 +576,10 @@ class persistent_ptr : public persistent_ptr_base {
576576
inline ptrdiff_t
577577
calculate_offset() const
578578
{
579-
static const ptrdiff_t ptr_offset_magic = 0xDEADBEEF;
579+
static const ptrdiff_t ptr_offset_magic = 0xF00000000000000;
580+
581+
static_assert(ptr_offset_magic % alignof(U) == 0, "");
582+
static_assert(ptr_offset_magic % alignof(T) == 0, "");
580583

581584
U *tmp{reinterpret_cast<U *>(ptr_offset_magic)};
582585
T *diff = static_cast<T *>(tmp);

tests/radix_tree/radix_concurrent_erase.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ test_erase_increment(nvobj::pool<root> &pop,
176176
it->value() == v);
177177
if (it != ptr->end()) {
178178
auto next = ++it;
179-
UT_ASSERT(next != ptr->end());
180-
UT_ASSERT(next->key() > k);
179+
if (next != ptr->end())
180+
UT_ASSERT(next->key() >
181+
k);
181182
}
182183
});
183184
}

0 commit comments

Comments
 (0)