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

Fixes #1164

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions include/libpmemobj++/persistent_ptr.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2015-2020, Intel Corporation */
/* Copyright 2015-2021, Intel Corporation */

/**
* @file
Expand Down Expand Up @@ -576,7 +576,10 @@ class persistent_ptr : public persistent_ptr_base {
inline ptrdiff_t
calculate_offset() const
{
static const ptrdiff_t ptr_offset_magic = 0xDEADBEEF;
static const ptrdiff_t ptr_offset_magic = 0xF00000000000000;

static_assert(ptr_offset_magic % alignof(U) == 0, "");
static_assert(ptr_offset_magic % alignof(T) == 0, "");

U *tmp{reinterpret_cast<U *>(ptr_offset_magic)};
T *diff = static_cast<T *>(tmp);
Expand Down
5 changes: 3 additions & 2 deletions tests/radix_tree/radix_concurrent_erase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ test_erase_increment(nvobj::pool<root> &pop,
it->value() == v);
if (it != ptr->end()) {
auto next = ++it;
UT_ASSERT(next != ptr->end());
UT_ASSERT(next->key() > k);
if (next != ptr->end())
UT_ASSERT(next->key() >
k);
}
});
}
Expand Down