Please enable JavaScript to view this site.

KOL/MCK - User Guide

type I64 = record

// 64 bit integer record. Use it and correspondent functions below in KOL projects to avoid dependancy from Delphi version (earlier versions of Delphi had no Int64 type).

 

Lo, Hi: DWORD;


end;

 

type PI64 = ^ I64;

 

function MakeInt64( Lo, Hi: DWORD ): I64;

Generates a long integer from two ordinary integers.

 

function Int2Int64( X: Integer ): I64;

"Converts" an integer data type to a long integer (equivalent to calling MakeInt64 (i, 0))

 

procedure IncInt64( var I64: I64; Delta: Integer );

Increases I: I64 by an integer delta.

I64 := I64 + Delta;

 

procedure DecInt64( var I64: I64; Delta: Integer );

Decreases I: I64 by delta.

I64 := I64 - Delta;

 

function Add64( const X, Y: I64 ): I64;

Adds two numbers like I64.

Result := X + Y;

 

function Sub64( const X, Y: I64 ): I64;

Subtracts I2 from I1.

Result := X - Y;

 

function Neg64( const X: I64 ): I64;

Returns -I.

Result := -X;

 

function Mul64i( const X: I64; Mul: Integer ): I64;

Multiplies the doubled integer I by the usual integer i.

Result := X * Mul;

 

function Div64i( const X: I64; D: Integer ): I64;

Divides a doubled whole into an ordinary whole.

Result := X div D;

 

function Mod64i( const X: I64; D: Integer ): Integer;

Calculates the remainder of dividing I by i.

Result := X mod D;

 

function Sgn64( const X: I64 ): Integer;

Result := sign( X ); i.e.:

if X < 0 then -1

if X = 0 then 0

if X > 0 then 1

 

function Cmp64( const X, Y: I64 ): Integer;

Compares two doubled integers (also returns -1, 0, 1, depending on whether the first parameter of the second is less, they are equal or the first is greater than the second.

Result := sign( X - Y ); i.e.

if X < Y then -1

if X = Y then 0

if X > Y then 1

 

function Int64_2Str( X: I64 ): AnsiString;

Converts a doubled integer to a string.

 

function Int64_2Hex( X: I64; MinDigits: Integer ): KOLString;

 

function Str2Int64( const S: AnsiString ): I64;

Converts a number in string representation to a doubled integer.

 

function Int64_2Double( const X: I64 ): Double;

 

function IsNan( const AValue: Double ): Boolean;

Checks if an argument passed is NAN.

 

function IsInfinity( const AValue: Double ): Boolean;

Checks if an argument passed is Infinite.

 

function IntPower( Base: Extended; Exponent: Integer ): Extended;

Result := Base ^ Exponent;

 

function NextPowerOf2( n: DWORD ): DWORD;

0->1, 1->1, 2->2, 3->4, 4->4, 5->8, ...

 

function Str2Double( const S: KOLString ): Double;

 

function Str2Extended( const S: KOLString ): Extended;

 

function Double2Str( D: Double ): KOLString;

 

function Extended2Str( E: Extended ): KOLString;

 

function Extended2StrDigits( D: Double; n: Integer ): KOLString;

Converts floating point number to string, leaving exactly n digits following floating point.

 

function Double2StrEx( D: Double ): KOLString;

experimental, do not use

 

function GetBits( N: DWORD; first, last: Byte ): DWord;

Retuns bits starting from <first> and to <last> inclusively.

 

function GetBitsL( N: DWORD; from, len: Byte ): DWord;

Retuns len bits starting from index <from>.

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC