3#ifndef TETL_MEMORY_POINTER_INT_PAIR_INFO_HPP
4#define TETL_MEMORY_POINTER_INT_PAIR_INFO_HPP
14template <
typename Po
interT,
unsigned IntBits,
typename PtrTraits>
17 static_assert(PtrTraits::free_bits < numeric_limits<etl::uintptr_t>::digits,
"cannot use a pointer type that has all bits free");
18 static_assert(IntBits <= PtrTraits::free_bits,
"pointer_int_pair with integer size too large for pointer");
24 static constexpr auto free_bits = pointer_traits::free_bits;
54 auto* voidPtr = pointer_traits::get_as_void_pointer(ptr);
constexpr auto bit_cast(From const &src) noexcept -> To
Obtain a value of type To by reinterpreting the object representation of from. Every bit in the value...
Definition bit_cast.hpp:38
Definition adjacent_find.hpp:8
TETL_BUILTIN_UINTPTR uintptr_t
Unsigned integer type capable of holding a pointer.
Definition uintptr_t.hpp:11
TETL_BUILTIN_INTPTR intptr_t
Signed integer type capable of holding a pointer.
Definition intptr_t.hpp:11
Definition pointer_int_pair_info.hpp:15
static constexpr auto int_mask
This is the unshifted mask for valid bits of the int type.
Definition pointer_int_pair_info.hpp:35
static constexpr auto int_bits
Definition pointer_int_pair_info.hpp:23
PointerT pointer_type
Definition pointer_int_pair_info.hpp:21
static constexpr auto free_bits
Definition pointer_int_pair_info.hpp:24
PtrTraits pointer_traits
Definition pointer_int_pair_info.hpp:22
static auto update_ptr(etl::intptr_t value, pointer_type ptr) -> etl::intptr_t
Definition pointer_int_pair_info.hpp:51
static constexpr auto ptr_mask
The bits that come from the pointer.
Definition pointer_int_pair_info.hpp:27
static auto update_int(etl::intptr_t value, etl::intptr_t integer) -> etl::intptr_t
Definition pointer_int_pair_info.hpp:59
static constexpr auto int_shift
The number of low bits that we reserve for other uses; and keep zero.
Definition pointer_int_pair_info.hpp:31
static constexpr auto shifted_int_mask
This is the bits for the integer shifted in place.
Definition pointer_int_pair_info.hpp:38
static auto get_int(etl::intptr_t value) -> etl::intptr_t
Definition pointer_int_pair_info.hpp:46
static auto get_pointer(etl::intptr_t value) -> pointer_type
Definition pointer_int_pair_info.hpp:40