mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Improve printf("%d") speed.
This commit is contained in:
@@ -522,16 +522,16 @@ fn usz? BigInt.to_format(&self, Formatter* format) @dynamic
|
||||
len++;
|
||||
a.negate();
|
||||
}
|
||||
uint[280] chunks;
|
||||
uint[280] chunks @noinit;
|
||||
int chunk_count;
|
||||
|
||||
const BASE10_9 = 1000000000;
|
||||
foreach_r(d : self.data)
|
||||
foreach_r(d : self.data[:self.len])
|
||||
{
|
||||
ulong carry = d;
|
||||
for (int i = 0; i < chunk_count; i++)
|
||||
{
|
||||
ulong v = chunks[i] * 4294967296ULL + carry;
|
||||
ulong v = (ulong)chunks[i] << 32 + carry;
|
||||
carry = v / BASE10_9;
|
||||
chunks[i] = (uint)(v - carry * BASE10_9);
|
||||
}
|
||||
@@ -551,11 +551,6 @@ fn usz? BigInt.to_format(&self, Formatter* format) @dynamic
|
||||
return len;
|
||||
}
|
||||
|
||||
fn String BigInt.to_string(&self, Allocator allocator) @dynamic
|
||||
{
|
||||
return self.to_string_with_radix(10, allocator);
|
||||
}
|
||||
|
||||
<*
|
||||
@require radix > 1 && radix <= 36 : "Radix must be 2-36"
|
||||
*>
|
||||
|
||||
Reference in New Issue
Block a user