Make more use of the new get_int_t

This commit is contained in:
Eladash 2019-07-07 21:32:50 +03:00 committed by kd-11
parent d57b4dc8f3
commit 9d9e158b9a
1 changed files with 12 additions and 9 deletions

View File

@ -412,9 +412,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? u64{std::numeric_limits<get_int_t<1>>::max()} :
ctx.type == 2 ? u64{std::numeric_limits<get_int_t<2>>::max()} :
ctx.type == 4 ? u64{std::numeric_limits<get_int_t<4>>::max()} :
u64{std::numeric_limits<get_int_t<8>>::max()};
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;
@ -468,9 +469,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? u64{std::numeric_limits<get_int_t<1>>::max()} :
ctx.type == 2 ? u64{std::numeric_limits<get_int_t<2>>::max()} :
ctx.type == 4 ? u64{std::numeric_limits<get_int_t<4>>::max()} :
u64{std::numeric_limits<get_int_t<8>>::max()};
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;
@ -531,9 +533,10 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
const u64 mask =
ctx.type == 1 ? 0xffull :
ctx.type == 2 ? 0xffffull :
ctx.type == 4 ? 0xffffffffull : 0xffffffffffffffffull;
ctx.type == 1 ? u64{std::numeric_limits<get_int_t<1>>::max()} :
ctx.type == 2 ? u64{std::numeric_limits<get_int_t<2>>::max()} :
ctx.type == 4 ? u64{std::numeric_limits<get_int_t<4>>::max()} :
u64{std::numeric_limits<get_int_t<8>>::max()};
// Trunc sign-extended signed types
const u64 val = src.template get<u64>(ctx.args) & mask;