std::math::bigint: Fixed init_with_array with empty array

This commit is contained in:
Jonas Quinten
2025-02-21 19:53:00 +01:00
committed by Christoffer Lerno
parent 38110b0269
commit ed62268997
2 changed files with 8 additions and 2 deletions

View File

@@ -63,6 +63,13 @@ fn BigInt* BigInt.init_with_u128(&self, uint128 value)
fn BigInt* BigInt.init_with_array(&self, uint[] values)
{
self.data[..] = 0;
if (values.len == 0)
{
self.len = 1;
return self;
}
self.len = values.len;
foreach_r(i, val : values)