32 explicit constexpr compat32_ptr(std::nullptr_t) noexcept : raw_addr_(0) {}
34 constexpr explicit compat32_ptr(uint32_t addr) noexcept : raw_addr_(addr) {}
40 [[nodiscard]]
constexpr uint32_t
raw_value() const noexcept {
return raw_addr_; }
45 [[nodiscard]]
constexpr uintptr_t
to_uintptr() const noexcept {
return static_cast<uintptr_t
>(raw_addr_); }
50 [[nodiscard]]
constexpr bool is_null() const noexcept {
return raw_addr_ == 0; }
55 [[nodiscard]]
constexpr explicit operator bool() const noexcept {
return raw_addr_ != 0; }
62 constexpr bool operator==(std::nullptr_t)
const noexcept {
return raw_addr_ == 0; }
64 constexpr bool operator!=(std::nullptr_t)
const noexcept {
return raw_addr_ != 0; }
68 uint32_t raw_addr_{0};
71static_assert(
sizeof(compat32_ptr<void>) == 4,
"compat32_ptr must be exactly 4 bytes");
72static_assert(
alignof(compat32_ptr<void>) == 4,
"compat32_ptr must be 4-byte aligned");
120 char (&scratch)[N],
size_t max_limit = 4096) noexcept {
133template <
typename T,
size_t N>
135 std::byte (&scratch)[N])
noexcept {
Type-erased remote address-space access and remote string/object views.
Type-erased, two-word handle to a remote address space.
Definition address_space.hpp:204
Value-type pointer storing a 32-bit address (for 64-bit hosts).
Definition compat32.hpp:24
constexpr bool operator==(std::nullptr_t) const noexcept
Compares against null.
Definition compat32.hpp:62
T element_type
Referenced element type.
Definition compat32.hpp:27
constexpr bool operator==(const compat32_ptr &other) const noexcept
Compares two pointers for equality.
Definition compat32.hpp:58
constexpr bool operator!=(const compat32_ptr &other) const noexcept
Compares two pointers for inequality.
Definition compat32.hpp:60
constexpr compat32_ptr() noexcept
Constructs a null pointer.
Definition compat32.hpp:30
constexpr uint32_t raw_value() const noexcept
Returns the raw 32-bit address.
Definition compat32.hpp:40
constexpr compat32_ptr(uint32_t addr) noexcept
Constructs a pointer from a 32-bit address.
Definition compat32.hpp:34
constexpr bool is_null() const noexcept
Reports whether the pointer is null.
Definition compat32.hpp:50
constexpr compat32_ptr(std::nullptr_t) noexcept
Constructs a null pointer.
Definition compat32.hpp:32
constexpr bool operator!=(std::nullptr_t) const noexcept
Compares against null.
Definition compat32.hpp:64
constexpr uintptr_t to_uintptr() const noexcept
Widens the address to a host pointer-size integer.
Definition compat32.hpp:45
Definition microfmt.hpp:881
Lazily-loaded reference to a trivially-copyable remote object.
Definition address_space.hpp:577
Streaming view of a remote NUL-terminated string.
Definition address_space.hpp:506
constexpr auto make_remote_ref32(compat32_ptr< T > ptr, address_space_ref space, std::byte(&scratch)[N]) noexcept
Builds a remote_ref over a 32-bit object pointer.
Definition compat32.hpp:134
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
RELOCO_CONSTEXPR20 void format_to(const sink &out, microfmt::string_view fmt, const Args &...args) noexcept
Definition microfmt.hpp:1766
constexpr auto make_remote_string32(compat32_ptr< const char > ptr, address_space_ref space, char(&scratch)[N], size_t max_limit=4096) noexcept
Builds a remote_string_view over a 32-bit string pointer.
Definition compat32.hpp:119