瀏覽代碼

* fixed software longint mod operation

florian 21 年之前
父節點
當前提交
c9e17321d7
共有 1 個文件被更改,包括 12 次插入13 次删除
  1. 12 13
      rtl/inc/generic.inc

+ 12 - 13
rtl/inc/generic.inc

@@ -926,23 +926,19 @@ function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGI
   begin
   begin
      if n=0 then
      if n=0 then
        HandleErrorFrame(200,get_frame);
        HandleErrorFrame(200,get_frame);
-     if n<0 then
+     nq:=abs(n);
+
+     if z<0 then
        begin
        begin
-          nq:=-n;
+          zq:=dword(-z);
           signed:=true;
           signed:=true;
        end
        end
      else
      else
        begin
        begin
-          signed:=false;
-          nq:=n;
+         zq:=z;
+         signed:=false;
        end;
        end;
-     if z<0 then
-       begin
-          zq:=dword(-z);
-          signed:=not(signed);
-       end
-     else
-       zq:=z;
+
      r:=zq mod nq;
      r:=zq mod nq;
      if signed then
      if signed then
        result:=-longint(r)
        result:=-longint(r)
@@ -1245,7 +1241,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.85  2004-11-02 08:50:40  florian
+  Revision 1.86  2004-11-06 13:36:42  florian
+    * fixed software longint mod operation
+
+  Revision 1.85  2004/11/02 08:50:40  florian
     * changed maxlongint to high(sizeint)
     * changed maxlongint to high(sizeint)
 
 
   Revision 1.83  2004/10/24 20:01:41  peter
   Revision 1.83  2004/10/24 20:01:41  peter
@@ -1465,4 +1464,4 @@ end;
       instead of direct comparisons of low/high values of orddefs because
       instead of direct comparisons of low/high values of orddefs because
       qword is a special case
       qword is a special case
 
 
-}
+}