From 1095f098ef68cf435622cd7b0cde7c0459871919 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Sat, 28 Jan 2023 01:23:15 +0100 Subject: [PATCH] Reduce formatter register formatter register type memory usage. --- lib/std/io/io_printf.c3 | 8 ++++---- lib/std/math/math_i128.c3 | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/std/io/io_printf.c3 b/lib/std/io/io_printf.c3 index be5c1b22b..fd685931d 100644 --- a/lib/std/io/io_printf.c3 +++ b/lib/std/io/io_printf.c3 @@ -66,13 +66,13 @@ macro void formatter_register_type($Type) $if ($checks($Type a, a.to_format(&&Formatter {}))): if (!toformat_functions.table.len) { - toformat_functions.init(512); + toformat_functions.init(64); } toformat_functions.set($Type.typeid, (ToFormatFunction)&$Type.to_format); $else: if (!tostring_functions.table.len) { - tostring_functions.init(512); + tostring_functions.init(64); } tostring_functions.set($Type.typeid, (ToStringFunction)&$Type.to_string); $endif; @@ -83,11 +83,11 @@ static initialize @priority(101) { if (!toformat_functions.table.len) { - toformat_functions.init(512); + toformat_functions.init(64); } if (!tostring_functions.table.len) { - tostring_functions.init(512); + tostring_functions.init(64); } } diff --git a/lib/std/math/math_i128.c3 b/lib/std/math/math_i128.c3 index 3aad9c13a..a471bec75 100644 --- a/lib/std/math/math_i128.c3 +++ b/lib/std/math/math_i128.c3 @@ -136,7 +136,7 @@ private macro float_from_i128($Type, a) { a <<= (MANT_DIG - sd); } - return bitcast(((($Rep)sign & SIGN_BIT) | ((($Rep)e + ($Rep)EXP_BIAS) << SIGNIFICANT_BITS)) | (($Rep)a & ($Rep)MANTISSA_MASK), $Type); + return bitcast((($Rep)sign & SIGN_BIT) | ((($Rep)e + ($Rep)EXP_BIAS) << SIGNIFICANT_BITS) | (($Rep)a & ($Rep)MANTISSA_MASK), $Type); } private macro float_from_u128($Type, a)