------------------------------------------------------------------------------
-- --
--- GNU ADA RUNTIME LIBRARY COMPONENTS --
+-- GNAT RUN-TIME LIBRARY COMPONENTS --
-- --
-- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 3 2 --
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2007, 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- --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- --
------------------------------------------------------------------------------
-with Unchecked_Conversion;
+with System.Address_Operations; use System.Address_Operations;
-package body System.Compare_Array_Unsigned_32 is
+with Ada.Unchecked_Conversion;
- function "+" (Left, Right : Address) return Address;
- pragma Import (Intrinsic, "+");
- -- Provide addition operation on type Address (this may not be directly
- -- available if type System.Address is non-private and the operations on
- -- the type are made abstract to hide them from public users of System.
+package body System.Compare_Array_Unsigned_32 is
type Word is mod 2 ** 32;
for Word'Size use 32;
type WP is access Word;
type UP is access Uword;
- function W is new Unchecked_Conversion (Address, WP);
- function U is new Unchecked_Conversion (Address, UP);
+ function W is new Ada.Unchecked_Conversion (Address, WP);
+ function U is new Ada.Unchecked_Conversion (Address, UP);
-----------------------
-- Compare_Array_U32 --
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
- Right_Len : Natural)
- return Integer
+ Right_Len : Natural) return Integer
is
Clen : Natural := Natural'Min (Left_Len, Right_Len);
-- Number of elements left to compare
begin
-- Case of going by aligned words
- if ((Left or Right) and (4 - 1)) = 0 then
+ if ModA (OrA (Left, Right), 4) = 0 then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
end if;
Clen := Clen - 1;
- L := L + 4;
- R := R + 4;
+ L := AddA (L, 4);
+ R := AddA (R, 4);
end loop;
-- Case of going by unaligned words
end if;
Clen := Clen - 1;
- L := L + 4;
- R := R + 4;
+ L := AddA (L, 4);
+ R := AddA (R, 4);
end loop;
end if;