mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-08 11:37:47 +02:00
* Add BinStr
This commit is contained in:
parent
2d309499e9
commit
4ec47938ee
@ -92,6 +92,11 @@ type
|
||||
TDynArrayIndex = NativeInt;
|
||||
TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
|
||||
|
||||
TCompareOption = ({coLingIgnoreCase, coLingIgnoreDiacritic, }coIgnoreCase{,
|
||||
coIgnoreKanaType, coIgnoreNonSpace, coIgnoreSymbols, coIgnoreWidth,
|
||||
coLingCasing, coDigitAsNumbers, coStringSort});
|
||||
TCompareOptions = set of TCompareOption;
|
||||
|
||||
{*****************************************************************************
|
||||
TObject, TClass, IUnknown, IInterface, TInterfacedObject
|
||||
*****************************************************************************}
|
||||
@ -360,6 +365,7 @@ function Pos(const Search, InString: String; StartAt : Integer): Integer; assemb
|
||||
procedure Insert(const Insertion: String; var Target: String; Index: Integer); overload;
|
||||
function upcase(c : char) : char; assembler;
|
||||
function HexStr(Val: NativeInt; cnt: byte): string; external name 'rtl.hexStr'; overload;
|
||||
function binstr(val : int64; cnt : byte) : string;
|
||||
|
||||
procedure val(const S: String; out NI : NativeInt; out Code: Integer); overload;
|
||||
procedure val(const S: String; out NI : NativeUInt; out Code: Integer); overload;
|
||||
@ -710,6 +716,18 @@ begin
|
||||
Code:=1;
|
||||
end;
|
||||
|
||||
function binstr(val : int64;cnt : byte) : string;
|
||||
var
|
||||
i : Integer;
|
||||
begin
|
||||
SetLength(Result,cnt);
|
||||
for i:=cnt downto 1 do
|
||||
begin
|
||||
Result[i]:=char(48+val and 1);
|
||||
val:=val shr 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function upcase(c : char) : char; assembler;
|
||||
asm
|
||||
return c.toUpperCase();
|
||||
|
Loading…
Reference in New Issue
Block a user