Fixed BigInt string initializers

This commit is contained in:
Stefan Müller 2024-05-14 16:52:09 +02:00
parent eee05a9646
commit 1caee9ae6e
1 changed files with 7 additions and 2 deletions

View File

@ -390,7 +390,12 @@ var
charBlockSize, offset, i, j, k, remainder: Integer; charBlockSize, offset, i, j, k, remainder: Integer;
d: Cardinal; d: Cardinal;
begin begin
charBlockSize := 64 div AFromBase; // 2 ^ (32 / charBlockSize) = AFromBase
case AFromBase of
2: charBlockSize := 32;
16: charBlockSize := 8;
end;
if AValue[1] = '-' then if AValue[1] = '-' then
begin begin
offset := 2; offset := 2;
@ -402,7 +407,7 @@ begin
end; end;
// Calculates the first (most significant) digit d of the result. // Calculates the first (most significant) digit d of the result.
DivMod(AValue.Length - offset, charBlockSize, i, remainder); DivMod(AValue.Length - offset + 1, charBlockSize, i, remainder);
k := offset; k := offset;
d := 0; d := 0;
// Checks the first block of chars that is not a full block. // Checks the first block of chars that is not a full block.