Reduce formatter register formatter register type memory usage.

This commit is contained in:
Christoffer Lerno
2023-01-28 01:23:15 +01:00
parent 9f63f77f22
commit 1095f098ef
2 changed files with 5 additions and 5 deletions

View File

@@ -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);
}
}

View File

@@ -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)