]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s-stoele.adb: Fix code for Address mod Storage_Offset for negative offset values
authorRobert Dewar <dewar@adacore.com>
Tue, 15 Nov 2005 14:04:45 +0000 (15:04 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 15 Nov 2005 14:04:45 +0000 (15:04 +0100)
2005-11-14  Robert Dewar  <dewar@adacore.com>

* s-stoele.adb: Fix code for Address mod Storage_Offset for negative
offset values

From-SVN: r107010

gcc/ada/s-stoele.adb

index 59eaf0b8215a31c076a4a4e7456851e487eea797..4d4f9594e76faa5bf37bfc0789c6e94c619ff731 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -61,15 +61,17 @@ package body System.Storage_Elements is
       return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right)));
    end "-";
 
-   function "mod" (Left : Address; Right : Storage_Offset)
-     return Storage_Offset is
+   function "mod"
+     (Left  : Address;
+      Right : Storage_Offset) return Storage_Offset
+   is
    begin
       if Right >= 0 then
          return Storage_Offset
                   (To_Integer (Left) mod Integer_Address (Right));
       else
          return -Storage_Offset
-                  (To_Integer (Left) mod Integer_Address (-Right));
+                  ((-To_Integer (Left)) mod Integer_Address (-Right));
       end if;
    end "mod";