X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2Futils.pas;h=26150aa3f2e4627706b19df003439de4c7d4a045;hb=36e374af750d9e3f049d97d9849a6629ff9b149b;hp=946e4f5a07c7a31a5422fad1f2f479fb83ffce6a;hpb=1b867d9fa61767acfef258fe29b900d3fd1af104;p=d2df-sdl.git diff --git a/src/shared/utils.pas b/src/shared/utils.pas index 946e4f5..26150aa 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -36,6 +36,12 @@ const wadExtensions: array [0..6] of AnsiString = ( '.dfzip' ); +{$IF DEFINED(FREEBSD) OR DEFINED(DARWIN)} +const NilThreadId = nil; +{$ELSE} +const NilThreadId = 0; +{$ENDIF} + // ////////////////////////////////////////////////////////////////////////// // type @@ -189,6 +195,7 @@ function readLongIntBE (st: TStream): LongInt; function readInt64BE (st: TStream): Int64; function readUInt64BE (st: TStream): UInt64; +function nlerp (a, b: Integer; t: Single): Integer; inline; function nmin (a, b: Byte): Byte; inline; overload; function nmin (a, b: ShortInt): ShortInt; inline; overload; @@ -1528,6 +1535,8 @@ function readUInt64BE (st: TStream): UInt64; begin readIntegerBE(st, @result, 8) // ////////////////////////////////////////////////////////////////////////// // +function nlerp (a, b: Integer; t: Single): Integer; inline; begin result := round((1.0 - t) * a + t * b); end; + function nmin (a, b: Byte): Byte; inline; overload; begin if (a < b) then result := a else result := b; end; function nmin (a, b: ShortInt): ShortInt; inline; overload; begin if (a < b) then result := a else result := b; end; function nmin (a, b: Word): Word; inline; overload; begin if (a < b) then result := a else result := b; end;