Browse Source

- removed the "else" in math.EnsureRange, because this way the compiler
generates entirely branchless code (via CMOVxx) on Pentium II or later (when
compiling with -CpPENTIUM2)

git-svn-id: trunk@36305 -

nickysn 8 years ago
parent
commit
958d74e41c
1 changed files with 6 additions and 6 deletions
  1. 6 6
      rtl/objpas/math.pp

+ 6 - 6
rtl/objpas/math.pp

@@ -2099,8 +2099,8 @@ function EnsureRange(const AValue, AMin, AMax: Integer): Integer;inline;
 begin
 begin
   Result:=AValue;
   Result:=AValue;
   If Result<AMin then
   If Result<AMin then
-    Result:=AMin
-  else if Result>AMax then
+    Result:=AMin;
+  if Result>AMax then
     Result:=AMax;
     Result:=AMax;
 end;
 end;
 
 
@@ -2109,8 +2109,8 @@ function EnsureRange(const AValue, AMin, AMax: Int64): Int64;inline;
 begin
 begin
   Result:=AValue;
   Result:=AValue;
   If Result<AMin then
   If Result<AMin then
-    Result:=AMin
-  else if Result>AMax then
+    Result:=AMin;
+  if Result>AMax then
     Result:=AMax;
     Result:=AMax;
 end;
 end;
 
 
@@ -2120,8 +2120,8 @@ function EnsureRange(const AValue, AMin, AMax: Double): Double;inline;
 begin
 begin
   Result:=AValue;
   Result:=AValue;
   If Result<AMin then
   If Result<AMin then
-    Result:=AMin
-  else if Result>AMax then
+    Result:=AMin;
+  if Result>AMax then
     Result:=AMax;
     Result:=AMax;
 end;
 end;
 {$endif FPC_HAS_TYPE_DOUBLE}
 {$endif FPC_HAS_TYPE_DOUBLE}