mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Reduce formatter register formatter register type memory usage.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user