This struct implements a pair of a pointer and small integer. It is designed to represent this in the space required by one pointer by bitmangling the integer into the low part of the pointer. This can only be done for small integers: typically up to 3 bits, but it depends on the number of bits available according to pointer_like_traits for the type.
More...
template<
typename PointerT,
unsigned IntBits,
typename IntType = unsigned,
typename PtrTraits = pointer_like_traits<PointerT>,
typename Info = pointer_int_pair_info<PointerT, IntBits, PtrTraits>>
struct etl::pointer_int_pair< PointerT, IntBits, IntType, PtrTraits, Info >
This struct implements a pair of a pointer and small integer. It is designed to represent this in the space required by one pointer by bitmangling the integer into the low part of the pointer. This can only be done for small integers: typically up to 3 bits, but it depends on the number of bits available according to pointer_like_traits for the type.
Note that pointer_int_pair always puts the IntVal part in the highest bits possible. For example, pointer_int_pair<void*, 1, bool> will put the bit for the bool into bit #2, not bit #0, which allows the low two bits to be used for something else. For example, this allows: pointer_int_pair<pointer_int_pair<void*, 1, bool>, 1, bool> ... and the two bools will land in different bits.
#if defined(TETL_ENABLE_CXX_MODULES)
import etl;
#else
#endif
{
#if not defined(TETL_WORKAROUND_AVR_BROKEN_TESTS)
auto val = 42.0;
assert(*ptr.get_pointer() == 42.0);
#endif
return 0;
}
#define assert(...)
Definition cassert.hpp:20
The class template bitset represents a fixed-size sequence of Bits bits. Bitsets can be manipulated b...
Definition bitset.hpp:23