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;
d: Cardinal;
begin
charBlockSize := 64 div AFromBase;
// 2 ^ (32 / charBlockSize) = AFromBase
case AFromBase of
2: charBlockSize := 32;
16: charBlockSize := 8;
end;
if AValue[1] = '-' then
begin
offset := 2;
@ -402,7 +407,7 @@ begin
end;
// 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;
d := 0;
// Checks the first block of chars that is not a full block.