Just wrote some Pascal functions for ClampInt to test it: function ClampInt1(X: LongInt): LongInt; inline; begin if (X < 0) then Result := 0 else Result := X; end;
function ClampInt2(X: LongInt): LongInt; inline; begin Result := 0; if (X > 0) then Result := X; end; The first one produces relatively convoluted assembly language when calling "I := ClampInt1(I);" 0000000100001634 89f8 mov %edi,%eax To use the integer clamp function as an example (if x < 0 then x := 0): > { Microsoft x64 calling convention... X is in ECX } > function ClampInt(X: LongInt): LongInt; assembler; nostackframe; inline; > asm > XOR EAX, EAX > TEST ECX, ECX > CMOVG EAX, ECX > end; try code: y:=0; if x < 0 then x:=y;
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel