From: Ketmar Dark Date: Tue, 5 Sep 2017 22:46:43 +0000 (+0300) Subject: don't be *too* smart: `swapInt()` should not do xor trick, 'cause we may pass the... X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=e796653d0ccd214192261ed1715dc68806758926;p=d2df-sdl.git don't be *too* smart: `swapInt()` should not do xor trick, 'cause we may pass the same var to it --- diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index b7b9e3f..280fd90 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -323,8 +323,8 @@ uses // ////////////////////////////////////////////////////////////////////////// // -//procedure swapInt (var a: Integer; var b: Integer); inline; var t: Integer; begin t := a; a := b; b := t; end; -procedure swapInt (var a: Integer; var b: Integer); inline; begin a := a xor b; b := b xor a; a := a xor b; end; +procedure swapInt (var a: Integer; var b: Integer); inline; var t: Integer; begin t := a; a := b; b := t; end; +//procedure swapInt (var a: Integer; var b: Integer); inline; begin a := a xor b; b := b xor a; a := a xor b; end; //function minInt (a, b: Integer): Integer; inline; begin if (a < b) then result := a else result := b; end; //function maxInt (a, b: Integer): Integer; inline; begin if (a > b) then result := a else result := b; end;