* added hex2dec64, 64-bit equivalent of hex2dec, mantis #33228

git-svn-id: trunk@38339 -
This commit is contained in:
marco 2018-02-25 15:27:53 +00:00
parent d49deb183b
commit 8ba434b2f4

View File

@ -1,4 +1,4 @@
{
{
Delphi/Kylix compatibility unit: String handling routines.
This file is part of the Free Pascal run time library.
@ -193,6 +193,7 @@ function XorDecode(const Key, Source: string): string;
function GetCmdLineArg(const Switch: string; SwitchChars: TSysCharSet): string;
function Numb2USA(const S: string): string;
function Hex2Dec(const S: string): Longint;
function Hex2Dec64(const S: string): int64;
function Dec2Numb(N: Longint; Len, Base: Byte): string;
function Numb2Dec(S: string; Base: Byte): Longint;
function IntToBin(Value: Longint; Digits, Spaces: Integer): string;
@ -858,6 +859,18 @@ begin
Result:=StrToInt(HexStr);
end;
function Hex2Dec64(const S: string): int64;
var
HexStr: string;
begin
if Pos('$',S)=0 then
HexStr:='$'+ S
else
HexStr:=S;
Result:=StrToInt64(HexStr);
end;
{
We turn off implicit exceptions, since these routines are tested, and it
saves 20% codesize (and some speed) and don't throw exceptions, except maybe