Skip to content

Commit

Permalink
iox-eclipse-iceoryx#2301 Use fixed width type for relative pointer of…
Browse files Browse the repository at this point in the history
…fset
  • Loading branch information
elBoberido committed Aug 22, 2024
1 parent e4f362b commit 8d58ced
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions iceoryx_hoofs/memory/include/iox/detail/relative_pointer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ inline typename RelativePointer<T>::offset_t RelativePointer<T>::getOffset(const
const auto* const basePtr = getBasePtr(id);
// AXIVION Next Construct AutosarC++19_03-A5.2.4, AutosarC++19_03-M5.2.9 : Cast needed for pointer arithmetic
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
return reinterpret_cast<offset_t>(ptr) - reinterpret_cast<offset_t>(basePtr);
return reinterpret_cast<std::uintptr_t>(ptr) - reinterpret_cast<std::uintptr_t>(basePtr);
}

template <typename T>
Expand All @@ -206,7 +206,7 @@ inline T* RelativePointer<T>::getPtr(const segment_id_t id, const offset_t offse
// AXIVION DISABLE STYLE AutosarC++19_03-M5.2.8 : Cast needed for pointer arithmetic
// AXIVION DISABLE STYLE AutosarC++19_03-M5.2.9 : Cast needed for pointer arithmetic
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast, performance-no-int-to-ptr)
return reinterpret_cast<ptr_t>(offset + reinterpret_cast<offset_t>(basePtr));
return reinterpret_cast<ptr_t>(offset + reinterpret_cast<std::uintptr_t>(basePtr));
// AXIVION ENABLE STYLE AutosarC++19_03-M5.2.9
// AXIVION ENABLE STYLE AutosarC++19_03-M5.2.8
// AXIVION ENABLE STYLE AutosarC++19_03-A5.2.4
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_hoofs/memory/include/iox/relative_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RelativePointer final
{
public:
using ptr_t = T*;
using offset_t = std::uintptr_t;
using offset_t = std::uint64_t;

/// @brief Default constructs a RelativePointer as a logical nullptr
RelativePointer() noexcept = default;
Expand Down

0 comments on commit 8d58ced

Please sign in to comment.