19 result =
static_cast<char>(
'0' +
static_cast<uint8_t
>(v % 10)) + result;
27 template <
typename Stream> msgpack::packer<Stream>&
operator()(msgpack::packer<Stream>& o,
uint128_t const& v)
const
32 o.pack_uint64(
static_cast<uint64_t
>(v));
36 o.pack_str(
static_cast<uint32_t
>(str.size()));
37 o.pack_str_body(str.c_str(),
static_cast<uint32_t
>(str.size()));
46 if (o.type == msgpack::type::POSITIVE_INTEGER) {
48 }
else if (o.type == msgpack::type::STR) {
53 if (o.via.str.size > 39) {
54 throw_or_abort(
"uint128_t deserialization failed: string too long");
57 for (
size_t i = 0; i < o.via.str.size; ++i) {
58 char c = o.via.str.ptr[i];
59 if (c <
'0' || c >
'9') {
60 throw_or_abort(
"uint128_t deserialization failed: Non-digit character in input");
63 result = result * 10 + (
static_cast<uint128_t>(c -
'0'));
constexpr std::array< uint8_t, S > convert(const std::string_view &in)
std::string uint128_to_decimal_string(uint128_t v)
unsigned __int128 uint128_t
msgpack::object const & operator()(msgpack::object const &o, uint128_t &v) const
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, uint128_t const &v) const
void throw_or_abort(std::string const &err)