X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fshared%2Futils.pas;h=57ce782cad7f8a10c7186575b5143de7b0753888;hp=946e4f5a07c7a31a5422fad1f2f479fb83ffce6a;hb=dffafd305d0df029f317cc92c1968ba0065c0cd8;hpb=2f006e551fc1f488f668ea844f12130351d62150 diff --git a/src/shared/utils.pas b/src/shared/utils.pas index 946e4f5..57ce782 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -189,6 +189,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 +1529,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;