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

Commit f8767aa

Browse files
peristent_ptr: add missing offset calculation
it wasn't added during one of merge's. ref. 1c37736
1 parent cceee18 commit f8767aa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
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
/*
2-
* Copyright 2015-2020, Intel Corporation
2+
* Copyright 2015-2021, Intel Corporation
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -636,7 +636,10 @@ class persistent_ptr : public persistent_ptr_base {
636636
inline ptrdiff_t
637637
calculate_offset() const
638638
{
639-
static const ptrdiff_t ptr_offset_magic = 0xDEADBEEF;
639+
static const ptrdiff_t ptr_offset_magic = 0xF00000000000000;
640+
641+
static_assert(ptr_offset_magic % alignof(U) == 0, "");
642+
static_assert(ptr_offset_magic % alignof(T) == 0, "");
640643

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

0 commit comments

Comments
 (0)