You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or you could have the functions take an already parsed and syntactically validated number to convert:
record
mantissaSigned: boolean;
mantissaIntegerStart: pchar; //assumed to match [0-9]* for base 10
mantissaIntegerLength: SizeUInt;
mantissaFractionStart: pchar //assumed to match [0-9]* for base 10
mantissaFractionLength: SizeUInt;
exponentSigned: boolean;
exponentStart: pchar; //assumed to match [0-9]* for base 10
exponentLength: SizeUInt;
end;
Then the functions do not need to parse it again.
Also I just learned that there is a faster way to check if an 8-character string only consists of decimal digits. That might make it faster:
const
selectFirstHalfByte8 = UInt64($F0F0F0F0F0F0F0F0);
decimalZeros8 = UInt64($3030303030303030);
overflowMaxDigit8 = UInt64($0606060606060606);
var temp8: UInt64;
begin
temp8 := PUInt64(stringof8characters)^;
if (temp8 and selectFirstHalfByte8) <> decimalZeros8 then exit(false);
temp8 := temp8 - decimalZeros8;
if ((temp8 + overflowMaxDigit8) and selectFirstHalfByte8) <> 0 then exit(false);
//now it is known to have all decimals
It always seems to set OK to true:
The text was updated successfully, but these errors were encountered: