10#include "../microfmt.hpp"
29 microfmt::string_view
name;
55 microfmt::string_view
name;
69template <
typename... Fields>
81template <
size_t N,
typename UInt = u
int32_t>
struct RELOCO_POINTER
reg_view {
100template <
size_t N,
typename UInt>
133 auto spec = ctx.spec();
134 for (
char c : spec) {
135 if (c ==
's' || c ==
'S')
137 else if (c ==
'n' || c ==
'N')
150 const auto &d = *rv.desc;
155 detail::format_unsigned<detail::radix::hex>(out,
static_cast<uint64_t
>(rv.value),
true,
156 static_cast<int>(d.byte_width * 2));
164 size_t printed_count = 0;
165 for (
size_t i = 0; i < N; ++i) {
166 RELOCO_BEGIN_UNSAFE_BUFFER_USAGE
168 const auto &f = d.fields[i];
170 RELOCO_END_UNSAFE_BUFFER_USAGE
172 const uint64_t mask = (f.bit_width == 64) ? ~0ULL : ((1ULL << f.bit_width) - 1ULL);
173 const uint64_t val = (
static_cast<uint64_t
>(rv.value) >> f.bit_offset) & mask;
175 if (f.is_flag || f.bit_width == 1) {
176 if (!detailed && val == 0) {
179 if (printed_count++ > 0)
189 if (!detailed && val == 0) {
192 if (printed_count++ > 0)
199 detail::format_unsigned<detail::radix::hex>(out, val,
false, 0);
201 detail::format_unsigned<detail::radix::decimal>(out, val,
false, 0);
Definition microfmt.hpp:881
#define MICROFMT_API_CLASS
Definition compat.hpp:181
constexpr auto format_reg(UInt val, const reg_descriptor< N > &desc) noexcept
Builds a reg_view from a register value and its descriptor.
Definition register.hpp:101
reloco::sink sink
Type-erased, zero-allocation output sink.
Definition microfmt.hpp:46
Static register descriptor listing its bitfields.
Definition register.hpp:51
microfmt::string_view name
Register name.
Definition register.hpp:55
Describes a single bitfield within a register.
Definition register.hpp:25
microfmt::string_view name
Human-readable field name.
Definition register.hpp:29
Non-owning view pairing a register value with its static descriptor.
Definition register.hpp:81
UInt value
Raw register value.
Definition register.hpp:85