瀏覽代碼

* avoid overflow error in ispowerof2 for -2^bitsize, the routine does not handle negative values

git-svn-id: trunk@37963 -
florian 7 年之前
父節點
當前提交
823c77e6cc
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      compiler/cutils.pas

+ 1 - 1
compiler/cutils.pas

@@ -910,7 +910,7 @@ implementation
       return if value is a power of 2. And if correct return the power
     }
       begin
-        if (value = 0) or (value and (value - 1) <> 0) then
+        if (value <= 0) or (value and (value - 1) <> 0) then
           exit(false);
         power:=BsfQWord(value);
         result:=true;