Commit 49c041e3 by Robert Dewar Committed by Arnaud Charlet

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

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
parent 5e804c9f
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -61,15 +61,17 @@ package body System.Storage_Elements is ...@@ -61,15 +61,17 @@ package body System.Storage_Elements is
return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right))); return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right)));
end "-"; end "-";
function "mod" (Left : Address; Right : Storage_Offset) function "mod"
return Storage_Offset is (Left : Address;
Right : Storage_Offset) return Storage_Offset
is
begin begin
if Right >= 0 then if Right >= 0 then
return Storage_Offset return Storage_Offset
(To_Integer (Left) mod Integer_Address (Right)); (To_Integer (Left) mod Integer_Address (Right));
else else
return -Storage_Offset return -Storage_Offset
(To_Integer (Left) mod Integer_Address (-Right)); ((-To_Integer (Left)) mod Integer_Address (-Right));
end if; end if;
end "mod"; end "mod";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment