MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unser

Method Unser

src/serialize.h:482–494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480 }
481
482 template <typename Stream, typename I> void Unser(Stream& s, I& v)
483 {
484 using U = typename std::conditional<std::is_enum<I>::value, std::underlying_type<I>, std::common_type<I>>::type::type;
485 static_assert(std::numeric_limits<U>::max() >= MAX && std::numeric_limits<U>::min() <= 0, "Assigned type too small");
486 uint64_t raw = 0;
487 if (BigEndian) {
488 s.read({BytePtr(&raw) + 8 - Bytes, Bytes});
489 v = static_cast<I>(be64toh(raw));
490 } else {
491 s.read({BytePtr(&raw), Bytes});
492 v = static_cast<I>(le64toh(raw));
493 }
494 }
495};
496
497template<int Bytes> using BigEndianFormatter = CustomUintFormatter<Bytes, true>;

Callers

nothing calls this directly

Calls 4

BytePtrFunction · 0.85
be64tohFunction · 0.85
le64tohFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected