From 9d9e158b9af1a4c833b25eb2359d9caf4b8a66bb Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 7 Jul 2019 21:32:50 +0300 Subject: [PATCH] Make more use of the new get_int_t --- Utilities/cfmt.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Utilities/cfmt.h b/Utilities/cfmt.h index 34bd511592..8caa9da117 100644 --- a/Utilities/cfmt.h +++ b/Utilities/cfmt.h @@ -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>::max()} : + ctx.type == 2 ? u64{std::numeric_limits>::max()} : + ctx.type == 4 ? u64{std::numeric_limits>::max()} : + u64{std::numeric_limits>::max()}; // Trunc sign-extended signed types const u64 val = src.template get(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>::max()} : + ctx.type == 2 ? u64{std::numeric_limits>::max()} : + ctx.type == 4 ? u64{std::numeric_limits>::max()} : + u64{std::numeric_limits>::max()}; // Trunc sign-extended signed types const u64 val = src.template get(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>::max()} : + ctx.type == 2 ? u64{std::numeric_limits>::max()} : + ctx.type == 4 ? u64{std::numeric_limits>::max()} : + u64{std::numeric_limits>::max()}; // Trunc sign-extended signed types const u64 val = src.template get(ctx.args) & mask;