[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 14:11:18 +0000 (16:11 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 14:11:18 +0000 (16:11 +0200)
2014-08-01  Thomas Quinot  <quinot@adacore.com>

* freeze.adb: Minor reformatting.

2014-08-01  Thomas Quinot  <quinot@adacore.com>

* exp_ch3.adb (Default_Initialize_Object): Do not generate
default initialization for an imported object.

2014-08-01  Olivier Hainque  <hainque@adacore.com>

* seh_init.c (__gnat_map_SEH): Cast argument of IsBadCodePtr
to the expected FARPROC type instead of void *.
* adaint.c (f2t): Expect __time64_t * as second argument, in line with
other datastructures.
(__gnat_file_time_name_attr): Adjust accordingly.
(__gnat_check_OWNER_ACL): Declare pSD as PSECURITY_DESCRIPTOR,
in line with uses.
(__gnat_check_OWNER_ACL): Declare AccessMode
parameter as ACCESS_MODE instead of DWORD, in line with callers
and uses.
(__gnat_set_executable): Add ATTRIBUTE_UNUSED on mode,
unused on win32.  Correct cast of "args" on call to spawnvp.
(add_handle): Cast realloc calls into their destination types.
(win32_wait): Remove declaration and initialization of unused variable.
(__gnat_locate_exec_on_path): Cast alloca calls
into their destination types.
* initialize.c (append_arg, __gnat_initialize): Cast xmalloc calls into
their destination types.

2014-08-01  Gary Dismukes  <dismukes@adacore.com>

* exp_ch4.adb (Expand_N_Type_Conversion): Expand
range checks for conversions between floating-point subtypes
when the target and source types are the same.

2014-08-01  Robert Dewar  <dewar@adacore.com>

* exp_aggr.adb: Minor reformatting.

2014-08-01  Eric Botcazou  <ebotcazou@adacore.com>

* sem_ch13.adb (Check_Indexing_Functions): Initialize
Indexing_Found.

2014-08-01  Arnaud Charlet  <charlet@adacore.com>

* gnat1drv.adb (Gnat1drv): In gnatprove mode, we now write the
ALI file before we call the backend (so that gnat2why can append
to it).

2014-08-01  Thomas Quinot  <quinot@adacore.com>

* exp_pakd.adb (Expand_Bit_Packed_Element_Set,
Expand_Packed_Element_Reference): Pass additional Rev_SSO
parameter indicating whether the packed array type has reverse
scalar storage order to the s-pack* Set/Get routines.
* s-pack*.ad* (Get, Set, GetU, SetU): New formal Rev_SSO
indicating reverse scalar storage order.

2014-08-01  Robert Dewar  <dewar@adacore.com>

* sem_ch3.adb (Check_Initialization): Set Do_Range_Check
for initial component value in -gnatc or GNATprove mode.
(Process_Discriminants): Same fix for default discriminant values.
* sem_eval.adb (Test_In_Range): Improve accuracy of results by
checking subtypes.

2014-08-01  Robert Dewar  <dewar@adacore.com>

* sinfo.ads: Minor comment clarification.

From-SVN: r213471

126 files changed:
gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/exp_aggr.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_pakd.adb
gcc/ada/freeze.adb
gcc/ada/gnat1drv.adb
gcc/ada/s-pack03.adb
gcc/ada/s-pack03.ads
gcc/ada/s-pack05.adb
gcc/ada/s-pack05.ads
gcc/ada/s-pack06.adb
gcc/ada/s-pack06.ads
gcc/ada/s-pack07.adb
gcc/ada/s-pack07.ads
gcc/ada/s-pack09.adb
gcc/ada/s-pack09.ads
gcc/ada/s-pack10.adb
gcc/ada/s-pack10.ads
gcc/ada/s-pack11.adb
gcc/ada/s-pack11.ads
gcc/ada/s-pack12.adb
gcc/ada/s-pack12.ads
gcc/ada/s-pack13.adb
gcc/ada/s-pack13.ads
gcc/ada/s-pack14.adb
gcc/ada/s-pack14.ads
gcc/ada/s-pack15.adb
gcc/ada/s-pack15.ads
gcc/ada/s-pack17.adb
gcc/ada/s-pack17.ads
gcc/ada/s-pack18.adb
gcc/ada/s-pack18.ads
gcc/ada/s-pack19.adb
gcc/ada/s-pack19.ads
gcc/ada/s-pack20.adb
gcc/ada/s-pack20.ads
gcc/ada/s-pack21.adb
gcc/ada/s-pack21.ads
gcc/ada/s-pack22.adb
gcc/ada/s-pack22.ads
gcc/ada/s-pack23.adb
gcc/ada/s-pack23.ads
gcc/ada/s-pack24.adb
gcc/ada/s-pack24.ads
gcc/ada/s-pack25.adb
gcc/ada/s-pack25.ads
gcc/ada/s-pack26.adb
gcc/ada/s-pack26.ads
gcc/ada/s-pack27.adb
gcc/ada/s-pack27.ads
gcc/ada/s-pack28.adb
gcc/ada/s-pack28.ads
gcc/ada/s-pack29.adb
gcc/ada/s-pack29.ads
gcc/ada/s-pack30.adb
gcc/ada/s-pack30.ads
gcc/ada/s-pack31.adb
gcc/ada/s-pack31.ads
gcc/ada/s-pack33.adb
gcc/ada/s-pack33.ads
gcc/ada/s-pack34.adb
gcc/ada/s-pack34.ads
gcc/ada/s-pack35.adb
gcc/ada/s-pack35.ads
gcc/ada/s-pack36.adb
gcc/ada/s-pack36.ads
gcc/ada/s-pack37.adb
gcc/ada/s-pack37.ads
gcc/ada/s-pack38.adb
gcc/ada/s-pack38.ads
gcc/ada/s-pack39.adb
gcc/ada/s-pack39.ads
gcc/ada/s-pack40.adb
gcc/ada/s-pack40.ads
gcc/ada/s-pack41.adb
gcc/ada/s-pack41.ads
gcc/ada/s-pack42.adb
gcc/ada/s-pack42.ads
gcc/ada/s-pack43.adb
gcc/ada/s-pack43.ads
gcc/ada/s-pack44.adb
gcc/ada/s-pack44.ads
gcc/ada/s-pack45.adb
gcc/ada/s-pack45.ads
gcc/ada/s-pack46.adb
gcc/ada/s-pack46.ads
gcc/ada/s-pack47.adb
gcc/ada/s-pack47.ads
gcc/ada/s-pack48.adb
gcc/ada/s-pack48.ads
gcc/ada/s-pack49.adb
gcc/ada/s-pack49.ads
gcc/ada/s-pack50.adb
gcc/ada/s-pack50.ads
gcc/ada/s-pack51.adb
gcc/ada/s-pack51.ads
gcc/ada/s-pack52.adb
gcc/ada/s-pack52.ads
gcc/ada/s-pack53.adb
gcc/ada/s-pack53.ads
gcc/ada/s-pack54.adb
gcc/ada/s-pack54.ads
gcc/ada/s-pack55.adb
gcc/ada/s-pack55.ads
gcc/ada/s-pack56.adb
gcc/ada/s-pack56.ads
gcc/ada/s-pack57.adb
gcc/ada/s-pack57.ads
gcc/ada/s-pack58.adb
gcc/ada/s-pack58.ads
gcc/ada/s-pack59.adb
gcc/ada/s-pack59.ads
gcc/ada/s-pack60.adb
gcc/ada/s-pack60.ads
gcc/ada/s-pack61.adb
gcc/ada/s-pack61.ads
gcc/ada/s-pack62.adb
gcc/ada/s-pack62.ads
gcc/ada/s-pack63.adb
gcc/ada/s-pack63.ads
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_eval.adb
gcc/ada/sinfo.ads

index 9b58a0836a2a285d8a11112fddf9b1d528159ab2..dba624f96bf5f3cf4ed7dc7f89fc29da6df0b244 100644 (file)
@@ -1,3 +1,75 @@
+2014-08-01  Thomas Quinot  <quinot@adacore.com>
+
+       * freeze.adb: Minor reformatting.
+
+2014-08-01  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_ch3.adb (Default_Initialize_Object): Do not generate
+       default initialization for an imported object.
+
+2014-08-01  Olivier Hainque  <hainque@adacore.com>
+
+       * seh_init.c (__gnat_map_SEH): Cast argument of IsBadCodePtr
+       to the expected FARPROC type instead of void *.
+       * adaint.c (f2t): Expect __time64_t * as second argument, in line with
+       other datastructures.
+       (__gnat_file_time_name_attr): Adjust accordingly.
+       (__gnat_check_OWNER_ACL): Declare pSD as PSECURITY_DESCRIPTOR,
+       in line with uses.
+       (__gnat_check_OWNER_ACL): Declare AccessMode
+       parameter as ACCESS_MODE instead of DWORD, in line with callers
+       and uses.
+       (__gnat_set_executable): Add ATTRIBUTE_UNUSED on mode,
+       unused on win32.  Correct cast of "args" on call to spawnvp.
+       (add_handle): Cast realloc calls into their destination types.
+       (win32_wait): Remove declaration and initialization of unused variable.
+       (__gnat_locate_exec_on_path): Cast alloca calls
+       into their destination types.
+       * initialize.c (append_arg, __gnat_initialize): Cast xmalloc calls into
+       their destination types.
+
+2014-08-01  Gary Dismukes  <dismukes@adacore.com>
+
+       * exp_ch4.adb (Expand_N_Type_Conversion): Expand
+       range checks for conversions between floating-point subtypes
+       when the target and source types are the same.
+
+2014-08-01  Robert Dewar  <dewar@adacore.com>
+
+       * exp_aggr.adb: Minor reformatting.
+
+2014-08-01  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sem_ch13.adb (Check_Indexing_Functions): Initialize
+       Indexing_Found.
+
+2014-08-01  Arnaud Charlet  <charlet@adacore.com>
+
+       * gnat1drv.adb (Gnat1drv): In gnatprove mode, we now write the
+       ALI file before we call the backend (so that gnat2why can append
+       to it).
+
+2014-08-01  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_pakd.adb (Expand_Bit_Packed_Element_Set,
+       Expand_Packed_Element_Reference): Pass additional Rev_SSO
+       parameter indicating whether the packed array type has reverse
+       scalar storage order to the s-pack* Set/Get routines.
+       * s-pack*.ad* (Get, Set, GetU, SetU): New formal Rev_SSO
+       indicating reverse scalar storage order.
+
+2014-08-01  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch3.adb (Check_Initialization): Set Do_Range_Check
+       for initial component value in -gnatc or GNATprove mode.
+       (Process_Discriminants): Same fix for default discriminant values.
+       * sem_eval.adb (Test_In_Range): Improve accuracy of results by
+       checking subtypes.
+
+2014-08-01  Robert Dewar  <dewar@adacore.com>
+
+       * sinfo.ads: Minor comment clarification.
+
 2014-08-01  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * sem_ch13.adb (Analyze_Aspect_Specifications): Code
index f7ca0d8b56f574cf57bc97ab5b6e70b9c65b4da1..8a1841814b79563b5df1b77fb5b2d1f2bf909205 100644 (file)
@@ -1310,7 +1310,7 @@ win32_filetime (HANDLE h)
 
 /* As above but starting from a FILETIME.  */
 static void
-f2t (const FILETIME *ft, time_t *t)
+f2t (const FILETIME *ft, __time64_t *t)
 {
   union
   {
@@ -1319,7 +1319,7 @@ f2t (const FILETIME *ft, time_t *t)
   } t_write;
 
   t_write.ft_time = *ft;
-  *t = (time_t) (t_write.ull_time / 10000000ULL - w32_epoch_offset);
+  *t = (__time64_t) (t_write.ull_time / 10000000ULL - w32_epoch_offset);
 }
 #endif
 
@@ -1332,7 +1332,7 @@ __gnat_file_time_name_attr (char* name, struct file_attributes* attr)
 #if defined (_WIN32) && !defined (RTX)
       BOOL res;
       WIN32_FILE_ATTRIBUTE_DATA fad;
-      time_t ret = -1;
+      __time64_t ret = -1;
       TCHAR wname[GNAT_MAX_PATH_LEN];
       S2WSC (wname, name, GNAT_MAX_PATH_LEN);
 
@@ -1748,7 +1748,7 @@ __gnat_check_OWNER_ACL (TCHAR *wname,
   BOOL fAccessGranted = FALSE;
   HANDLE hToken = NULL;
   DWORD nLength = 0;
-  SECURITY_DESCRIPTOR* pSD = NULL;
+  PSECURITY_DESCRIPTOR pSD = NULL;
 
   GetFileSecurity
     (wname, OWNER_SECURITY_INFORMATION |
@@ -1808,7 +1808,7 @@ __gnat_check_OWNER_ACL (TCHAR *wname,
 
 static void
 __gnat_set_OWNER_ACL (TCHAR *wname,
-                     DWORD AccessMode,
+                     ACCESS_MODE AccessMode,
                      DWORD AccessPermissions)
 {
   PACL pOldDACL = NULL;
@@ -2022,7 +2022,7 @@ __gnat_set_writable (char *name)
 #define S_OTHERS 4
 
 void
-__gnat_set_executable (char *name, int mode)
+__gnat_set_executable (char *name, int mode ATTRIBUTE_UNUSED)
 {
 #if defined (_WIN32) && !defined (RTX)
   TCHAR wname [GNAT_MAX_PATH_LEN + 2];
@@ -2177,7 +2177,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
   strcat (args[0], args_0);
   strcat (args[0], "\"");
 
-  status = spawnvp (P_WAIT, args_0, (char* const*)args);
+  status = spawnvp (P_WAIT, args_0, (char ** const)args);
 
   /* restore previous value */
   free (args[0]);
@@ -2325,7 +2325,7 @@ add_handle (HANDLE h, int pid)
     {
       plist_max_length += 1000;
       HANDLES_LIST =
-        (void **) xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length);
+        (HANDLE *) xrealloc (HANDLES_LIST, sizeof (HANDLE) * plist_max_length);
       PID_LIST =
         (int *) xrealloc (PID_LIST, sizeof (int) * plist_max_length);
     }
@@ -2445,7 +2445,6 @@ win32_wait (int *status)
   HANDLE *hl;
   HANDLE h;
   DWORD res;
-  int k;
   int hl_len;
 
   if (plist_length == 0)
@@ -2454,8 +2453,6 @@ win32_wait (int *status)
       return -1;
     }
 
-  k = 0;
-
   /* -------------------- critical section -------------------- */
   (*Lock_Task) ();
 
index 033ad011db84cac908ede11de949f6bd252f00c6..0214a6b237878fd019828c3537feed7fd7ba1646 100644 (file)
@@ -2114,17 +2114,18 @@ package body Exp_Aggr is
          Discr_Val   : Elmt_Id;
 
       begin
-         Btype := Base_Type (Typ);
-
-         --  The constraints on the hidden discriminants, if present, are
-         --  kep in the Stored_Constraint list of the type itself, or in
-         --  that of the base type.
+         --  The constraints on the hidden discriminants, if present, are kept
+         --  in the Stored_Constraint list of the type itself, or in that of
+         --  the base type.
 
+         Btype := Base_Type (Typ);
          while Is_Derived_Type (Btype)
            and then (Present (Stored_Constraint (Btype))
-             or else Present (Stored_Constraint (Typ)))
+                       or else
+                     Present (Stored_Constraint (Typ)))
          loop
             Parent_Type := Etype (Btype);
+
             if not Has_Discriminants (Parent_Type) then
                return;
             end if;
index f90c60d7fcdd946df4df35bb095803dd87b3a513..e21e9e416987a5bc3c0b38bab44d93e52b95d892 100644 (file)
@@ -5068,6 +5068,16 @@ package body Exp_Ch3 is
       --  Start of processing for Default_Initialize_Object
 
       begin
+         --  Default initialization is suppressed for objects that are already
+         --  known to be imported (i.e. whose declaration specifies the Import
+         --  aspect). Note that for objects with a pragma Import, we generate
+         --  initialization here, and then remove it downstream when processing
+         --  the pragma.
+
+         if Is_Imported (Def_Id) then
+            return;
+         end if;
+
          --  Step 1: Initialize the object
 
          if Needs_Finalization (Typ) and then not No_Initialization (N) then
index 11833e5b68d5b5e7e3def09e5d9fddaedc94a375..3f82220a2727f3c90535f784985e3f1b8de77f7b 100644 (file)
@@ -10835,60 +10835,78 @@ package body Exp_Ch4 is
 
       --  The only remaining step is to generate a range check if we still have
       --  a type conversion at this stage and Do_Range_Check is set. For now we
-      --  do this only for conversions of discrete types.
+      --  do this only for conversions of discrete types and for floating-point
+      --  conversions where the base types of source and target are the same.
 
-      if Nkind (N) = N_Type_Conversion
-        and then Is_Discrete_Type (Etype (N))
-      then
-         declare
-            Expr : constant Node_Id := Expression (N);
-            Ftyp : Entity_Id;
-            Ityp : Entity_Id;
+      if Nkind (N) = N_Type_Conversion then
 
-         begin
-            if Do_Range_Check (Expr)
-              and then Is_Discrete_Type (Etype (Expr))
-            then
-               Set_Do_Range_Check (Expr, False);
+         --  For now we only support floating-point cases where the base types
+         --  of the target type and source expression are the same, so there's
+         --  potentially only a range check. Conversions where the source and
+         --  target have different base types are still TBD. ???
 
-               --  Before we do a range check, we have to deal with treating a
-               --  fixed-point operand as an integer. The way we do this is
-               --  simply to do an unchecked conversion to an appropriate
-               --  integer type large enough to hold the result.
+         if Is_Floating_Point_Type (Etype (N))
+           and then
+             Base_Type (Etype (N)) = Base_Type (Etype (Expression (N)))
+         then
+            if Do_Range_Check (Expression (N))
+              and then Is_Floating_Point_Type (Target_Type)
+            then
+               Generate_Range_Check
+                 (Expression (N), Target_Type, CE_Range_Check_Failed);
+            end if;
 
-               --  This code is not active yet, because we are only dealing
-               --  with discrete types so far ???
+         elsif Is_Discrete_Type (Etype (N)) then
+            declare
+               Expr : constant Node_Id := Expression (N);
+               Ftyp : Entity_Id;
+               Ityp : Entity_Id;
 
-               if Nkind (Expr) in N_Has_Treat_Fixed_As_Integer
-                 and then Treat_Fixed_As_Integer (Expr)
+            begin
+               if Do_Range_Check (Expr)
+                 and then Is_Discrete_Type (Etype (Expr))
                then
-                  Ftyp := Base_Type (Etype (Expr));
+                  Set_Do_Range_Check (Expr, False);
 
-                  if Esize (Ftyp) >= Esize (Standard_Integer) then
-                     Ityp := Standard_Long_Long_Integer;
-                  else
-                     Ityp := Standard_Integer;
-                  end if;
+                  --  Before we do a range check, we have to deal with treating
+                  --  a fixed-point operand as an integer. The way we do this
+                  --  is simply to do an unchecked conversion to an appropriate
+                  --  integer type large enough to hold the result.
 
-                  Rewrite (Expr, Unchecked_Convert_To (Ityp, Expr));
-               end if;
+                  --  This code is not active yet, because we are only dealing
+                  --  with discrete types so far ???
 
-               --  Reset overflow flag, since the range check will include
-               --  dealing with possible overflow, and generate the check. If
-               --  Address is either a source type or target type, suppress
-               --  range check to avoid typing anomalies when it is a visible
-               --  integer type.
+                  if Nkind (Expr) in N_Has_Treat_Fixed_As_Integer
+                    and then Treat_Fixed_As_Integer (Expr)
+                  then
+                     Ftyp := Base_Type (Etype (Expr));
 
-               Set_Do_Overflow_Check (N, False);
+                     if Esize (Ftyp) >= Esize (Standard_Integer) then
+                        Ityp := Standard_Long_Long_Integer;
+                     else
+                        Ityp := Standard_Integer;
+                     end if;
 
-               if not Is_Descendent_Of_Address (Etype (Expr))
-                 and then not Is_Descendent_Of_Address (Target_Type)
-               then
-                  Generate_Range_Check
-                    (Expr, Target_Type, CE_Range_Check_Failed);
+                     Rewrite (Expr, Unchecked_Convert_To (Ityp, Expr));
+                  end if;
+
+                  --  Reset overflow flag, since the range check will include
+                  --  dealing with possible overflow, and generate the check.
+                  --  If Address is either a source type or target type,
+                  --  suppress range check to avoid typing anomalies when
+                  --  it is a visible integer type.
+
+                  Set_Do_Overflow_Check (N, False);
+
+                  if not Is_Descendent_Of_Address (Etype (Expr))
+                    and then not Is_Descendent_Of_Address (Target_Type)
+                  then
+                     Generate_Range_Check
+                       (Expr, Target_Type, CE_Range_Check_Failed);
+                  end if;
                end if;
-            end if;
-         end;
+            end;
+         end if;
       end if;
 
       --  Here at end of processing
index be5f7f2e9cf6b638af91cc8d754e4f302d509ffb..6ff75278d9705758f1169545d35d8f062f7cd569 100644 (file)
@@ -1727,6 +1727,7 @@ package body Exp_Pakd is
             Set_nn  : Entity_Id;
             Subscr  : Node_Id;
             Atyp    : Entity_Id;
+            Rev_SSO : Node_Id;
 
          begin
             if No (Bits_nn) then
@@ -1752,6 +1753,12 @@ package body Exp_Pakd is
             Atyp := Etype (Obj);
             Compute_Linear_Subscript (Atyp, Lhs, Subscr);
 
+            --  Set indication of whether the packed array has reverse SSO
+
+            Rev_SSO :=
+              New_Occurrence_Of
+                (Boolean_Literals (Reverse_Storage_Order (Atyp)), Loc);
+
             --  Below we must make the assumption that Obj is
             --  at least byte aligned, since otherwise its address
             --  cannot be taken. The assumption holds since the
@@ -1767,8 +1774,8 @@ package body Exp_Pakd is
                       Prefix         => Obj,
                       Attribute_Name => Name_Address),
                     Subscr,
-                    Unchecked_Convert_To (Bits_nn,
-                      Convert_To (Ctyp, Rhs)))));
+                    Unchecked_Convert_To (Bits_nn, Convert_To (Ctyp, Rhs)),
+                    Rev_SSO)));
 
          end;
       end if;
@@ -2127,8 +2134,11 @@ package body Exp_Pakd is
          --  where Subscr is the computed linear subscript
 
          declare
-            Get_nn : Entity_Id;
-            Subscr : Node_Id;
+            Get_nn  : Entity_Id;
+            Subscr  : Node_Id;
+            Rev_SSO : constant Node_Id :=
+              New_Occurrence_Of
+                (Boolean_Literals (Reverse_Storage_Order (Atyp)), Loc);
 
          begin
             --  Acquire proper Get entity. We use the aligned or unaligned
@@ -2158,12 +2168,12 @@ package body Exp_Pakd is
                     Make_Attribute_Reference (Loc,
                       Prefix         => Obj,
                       Attribute_Name => Name_Address),
-                    Subscr))));
+                    Subscr,
+                    Rev_SSO))));
          end;
       end if;
 
       Analyze_And_Resolve (N, Ctyp, Suppress => All_Checks);
-
    end Expand_Packed_Element_Reference;
 
    ----------------------
index 8963ad0c772d08c7a52abe1de31dee4bc7f577f9..fb4241a40aa2a64dabc260a1409eadf7b100b5bf 100644 (file)
@@ -3701,8 +3701,7 @@ package body Freeze is
 
             --  Acquire copy of Inline pragma
 
-            Iprag :=
-              Copy_Separate_Tree (Import_Pragma (E));
+            Iprag := Copy_Separate_Tree (Import_Pragma (E));
 
             --  Fix up spec to be not imported any more
 
index 2ed775534183f21ce4fb5b485dfe6b37e854011c..e074b08d41a706546bfe977a1210ccba59edc7c1 100644 (file)
@@ -1243,6 +1243,19 @@ begin
 
       Prepcomp.Add_Dependencies;
 
+      --  In gnatprove mode we're writing the ALI much earlier than usual
+      --  as flow analysis needs the file present in order to append its
+      --  own globals to it.
+
+      if GNATprove_Mode then
+
+         --  Note: In GNATprove mode, an "object" file is always generated as
+         --  the result of calling gnat1 or gnat2why, although this is not the
+         --  same as the object file produced for compilation.
+
+         Write_ALI (Object => True);
+      end if;
+
       --  Back end needs to explicitly unlock tables it needs to touch
 
       Atree.Lock;
@@ -1295,12 +1308,9 @@ begin
          Exit_Program (E_Errors);
       end if;
 
-      --  In GNATprove mode, an "object" file is always generated as the
-      --  result of calling gnat1 or gnat2why, although this is not the
-      --  same as the object file produced for compilation.
-
-      Write_ALI (Object => (Back_End_Mode = Generate_Object
-                             or else GNATprove_Mode));
+      if not GNATprove_Mode then
+         Write_ALI (Object => (Back_End_Mode = Generate_Object));
+      end if;
 
       if not Compilation_Errors then
 
index 3d88c8e5535de41824d00570a2b042e5f1360b87..b081dc27f8f7d5f1d82300620e7b94f2ed014995 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_03 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_03 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_03 --
    ------------
 
-   function Get_03 (Arr : System.Address; N : Natural) return Bits_03 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_03
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_03
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_03;
 
    ------------
    -- Set_03 --
    ------------
 
-   procedure Set_03 (Arr : System.Address; N : Natural; E : Bits_03) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_03
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_03;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_03;
 
 end System.Pack_03;
index d8f35c705558d2b79458fc407a340f286f759f7d..265246ce8a3c7bff4fb11f68dc610ffc565abc0f 100644 (file)
@@ -39,11 +39,21 @@ package System.Pack_03 is
    type Bits_03 is mod 2 ** Bits;
    for Bits_03'Size use Bits;
 
-   function Get_03 (Arr : System.Address; N : Natural) return Bits_03;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_03
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_03 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_03 (Arr : System.Address; N : Natural; E : Bits_03);
+   procedure Set_03
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_03;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 42af6b1308ce48fe12132a199441a4d36a9fa6cc..645c3a7df6eceae05938b1fdfcd5fbb3e803e7ae 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_05 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_05 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_05 --
    ------------
 
-   function Get_05 (Arr : System.Address; N : Natural) return Bits_05 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_05
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_05
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_05;
 
    ------------
    -- Set_05 --
    ------------
 
-   procedure Set_05 (Arr : System.Address; N : Natural; E : Bits_05) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_05
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_05;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_05;
 
 end System.Pack_05;
index 761ae4fa3f28b3985ca1c8d6f19dbcc42be4f4d8..567bdc785515325ee6d90f59ce5b71363aa4249d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_05 is
    type Bits_05 is mod 2 ** Bits;
    for Bits_05'Size use Bits;
 
-   function Get_05 (Arr : System.Address; N : Natural) return Bits_05;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_05
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_05 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_05 (Arr : System.Address; N : Natural; E : Bits_05);
+   procedure Set_05
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_05;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index a8cf24e842b6bf01900df722e0abe9289970ff32..e467af0631e02d8aa0fa4f05ca78a4a9d121d453 100644 (file)
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_06 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_06 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_06 or SetU_06 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_06 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_06 --
    ------------
 
-   function Get_06 (Arr : System.Address; N : Natural) return Bits_06 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_06
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_06
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_06;
 
    -------------
    -- GetU_06 --
    -------------
 
-   function GetU_06 (Arr : System.Address; N : Natural) return Bits_06 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_06
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_06
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_06;
 
    ------------
    -- Set_06 --
    ------------
 
-   procedure Set_06 (Arr : System.Address; N : Natural; E : Bits_06) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_06
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_06;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_06;
 
    -------------
    -- SetU_06 --
    -------------
 
-   procedure SetU_06 (Arr : System.Address; N : Natural; E : Bits_06) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_06
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_06;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_06;
 
 end System.Pack_06;
index 8d907c1b0d189c3fa38f7804a848078f784f02d1..9db47345386c7746621b77ed7fed7fdbc714f9c3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_06 is
    type Bits_06 is mod 2 ** Bits;
    for Bits_06'Size use Bits;
 
-   function Get_06 (Arr : System.Address; N : Natural) return Bits_06;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_06
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_06 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_06 (Arr : System.Address; N : Natural; E : Bits_06);
+   procedure Set_06
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_06;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_06 (Arr : System.Address; N : Natural) return Bits_06;
+   function GetU_06
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_06 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_06 (Arr : System.Address; N : Natural; E : Bits_06);
+   procedure SetU_06
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_06;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 0dc35e70d5c5f3c1b51fdfac3c2e8ea797527345..45ba8bddd058b677fb5f85836c9c50370dfd405c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_07 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_07 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_07 --
    ------------
 
-   function Get_07 (Arr : System.Address; N : Natural) return Bits_07 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_07
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_07
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_07;
 
    ------------
    -- Set_07 --
    ------------
 
-   procedure Set_07 (Arr : System.Address; N : Natural; E : Bits_07) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_07
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_07;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_07;
 
 end System.Pack_07;
index b1b125a1512b91407ef4c2dee0544c2f45f5dfb1..a0fa35d298ba24ee150d53bf4f96043c220cdbce 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_07 is
    type Bits_07 is mod 2 ** Bits;
    for Bits_07'Size use Bits;
 
-   function Get_07 (Arr : System.Address; N : Natural) return Bits_07;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_07
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_07 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_07 (Arr : System.Address; N : Natural; E : Bits_07);
+   procedure Set_07
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_07;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 26ac890877586949e3ddee2ed456f67c0dd34271..e0360bbba4f39bfafcc5adc7319592fbad177305 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_09 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_09 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_09 --
    ------------
 
-   function Get_09 (Arr : System.Address; N : Natural) return Bits_09 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_09
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_09
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_09;
 
    ------------
    -- Set_09 --
    ------------
 
-   procedure Set_09 (Arr : System.Address; N : Natural; E : Bits_09) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_09
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_09;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_09;
 
 end System.Pack_09;
index be99821f6c2d2f798f991466343020c18aca1573..78defe038b26d41c1d0353f082a0d1b629153fb7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_09 is
    type Bits_09 is mod 2 ** Bits;
    for Bits_09'Size use Bits;
 
-   function Get_09 (Arr : System.Address; N : Natural) return Bits_09;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_09
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_09 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_09 (Arr : System.Address; N : Natural; E : Bits_09);
+   procedure Set_09
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_09;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 0fbd13ef962a99c36691aa7b695395d192374dc2..402c9fa78672de2d171cf531cad75d7b2240e511 100644 (file)
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_10 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_10 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_10 or SetU_10 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_10 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_10 --
    ------------
 
-   function Get_10 (Arr : System.Address; N : Natural) return Bits_10 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_10
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_10
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_10;
 
    -------------
    -- GetU_10 --
    -------------
 
-   function GetU_10 (Arr : System.Address; N : Natural) return Bits_10 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_10
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_10
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_10;
 
    ------------
    -- Set_10 --
    ------------
 
-   procedure Set_10 (Arr : System.Address; N : Natural; E : Bits_10) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_10
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_10;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_10;
 
    -------------
    -- SetU_10 --
    -------------
 
-   procedure SetU_10 (Arr : System.Address; N : Natural; E : Bits_10) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_10
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_10;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_10;
 
 end System.Pack_10;
index fcd1d127d25ece980f1525a2106abebba056a96d..dc4113efeed673cc70bcbce25c3516941ef21f60 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_10 is
    type Bits_10 is mod 2 ** Bits;
    for Bits_10'Size use Bits;
 
-   function Get_10 (Arr : System.Address; N : Natural) return Bits_10;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_10
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_10 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_10 (Arr : System.Address; N : Natural; E : Bits_10);
+   procedure Set_10
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_10;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_10 (Arr : System.Address; N : Natural) return Bits_10;
+   function GetU_10
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_10 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_10 (Arr : System.Address; N : Natural; E : Bits_10);
+   procedure SetU_10
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_10;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 62737fb835def95158a1a02466810fb722e59217..23edceb12cd74bf430dde07db97f4ffad891c2ab 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_11 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_11 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_11 --
    ------------
 
-   function Get_11 (Arr : System.Address; N : Natural) return Bits_11 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_11
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_11
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_11;
 
    ------------
    -- Set_11 --
    ------------
 
-   procedure Set_11 (Arr : System.Address; N : Natural; E : Bits_11) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_11
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_11;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_11;
 
 end System.Pack_11;
index 9c880d266956bbd677d121bcf30c550c2710d422..e812a0057ea93e5811a9261d98575bf3b65bd4c8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_11 is
    type Bits_11 is mod 2 ** Bits;
    for Bits_11'Size use Bits;
 
-   function Get_11 (Arr : System.Address; N : Natural) return Bits_11;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_11
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_11 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_11 (Arr : System.Address; N : Natural; E : Bits_11);
+   procedure Set_11
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_11;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index d43cca14a24b75ebcdc8335089e2b8d251d66a4e..69b090dc7bb0e3de113cfdd4af4ca9a8f390d496 100644 (file)
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_12 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_12 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_12 or SetU_12 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_12 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_12 --
    ------------
 
-   function Get_12 (Arr : System.Address; N : Natural) return Bits_12 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_12
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_12
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_12;
 
    -------------
    -- GetU_12 --
    -------------
 
-   function GetU_12 (Arr : System.Address; N : Natural) return Bits_12 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_12
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_12
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_12;
 
    ------------
    -- Set_12 --
    ------------
 
-   procedure Set_12 (Arr : System.Address; N : Natural; E : Bits_12) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_12
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_12;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_12;
 
    -------------
    -- SetU_12 --
    -------------
 
-   procedure SetU_12 (Arr : System.Address; N : Natural; E : Bits_12) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_12
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_12;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_12;
 
 end System.Pack_12;
index ec8b0732e9278d44903bc3eb5d49dd163d5accf5..ae0af7e635fb8e5e3075636e7741fbedd52307d8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_12 is
    type Bits_12 is mod 2 ** Bits;
    for Bits_12'Size use Bits;
 
-   function Get_12 (Arr : System.Address; N : Natural) return Bits_12;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_12
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_12 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_12 (Arr : System.Address; N : Natural; E : Bits_12);
+   procedure Set_12
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_12;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_12 (Arr : System.Address; N : Natural) return Bits_12;
+   function GetU_12
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_12 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_12 (Arr : System.Address; N : Natural; E : Bits_12);
+   procedure SetU_12
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_12;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index d08b5a184d97b4c4ef0e75087e7aa593befa04ef..0970d694810290c0bde0b80a585dded31fe55f61 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_13 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_13 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_13 --
    ------------
 
-   function Get_13 (Arr : System.Address; N : Natural) return Bits_13 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_13
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_13
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_13;
 
    ------------
    -- Set_13 --
    ------------
 
-   procedure Set_13 (Arr : System.Address; N : Natural; E : Bits_13) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_13
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_13;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_13;
 
 end System.Pack_13;
index a5b6258126b910fdf556ac3fabb5e1efddeb21ae..f58fbf7c61ff336061fe23dd30a690ce51c0a095 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_13 is
    type Bits_13 is mod 2 ** Bits;
    for Bits_13'Size use Bits;
 
-   function Get_13 (Arr : System.Address; N : Natural) return Bits_13;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_13
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_13 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_13 (Arr : System.Address; N : Natural; E : Bits_13);
+   procedure Set_13
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_13;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 0ef322d18b445a0dc2732b9eb9cbc4e843d519ca..8cae0d7091e26ad10bc4e92e425d3bce2766b211 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_14 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_14 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_14 or SetU_14 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_14 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_14 --
    ------------
 
-   function Get_14 (Arr : System.Address; N : Natural) return Bits_14 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_14
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_14
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_14;
 
    -------------
    -- GetU_14 --
    -------------
 
-   function GetU_14 (Arr : System.Address; N : Natural) return Bits_14 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_14
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_14
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_14;
 
    ------------
    -- Set_14 --
    ------------
 
-   procedure Set_14 (Arr : System.Address; N : Natural; E : Bits_14) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_14
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_14;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_14;
 
    -------------
    -- SetU_14 --
    -------------
 
-   procedure SetU_14 (Arr : System.Address; N : Natural; E : Bits_14) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_14
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_14;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_14;
 
 end System.Pack_14;
index aecd6f089cda922ddeb29ad44f2858001ed68566..72cd783c5a627e89240db435407d7de9131718c3 100644 (file)
@@ -39,20 +39,37 @@ package System.Pack_14 is
    type Bits_14 is mod 2 ** Bits;
    for Bits_14'Size use Bits;
 
-   function Get_14 (Arr : System.Address; N : Natural) return Bits_14;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_14
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_14 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_14 (Arr : System.Address; N : Natural; E : Bits_14);
+   procedure Set_14
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_14;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_14 (Arr : System.Address; N : Natural) return Bits_14;
+   function GetU_14
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_14 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_14 (Arr : System.Address; N : Natural; E : Bits_14);
+   procedure SetU_14
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_14;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 7e9c65f07e31522ca70b3a1a8a3913f3509c5af6..4df1841d667c2b05a1a34cc534b92946a1130161 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_15 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_15 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_15 --
    ------------
 
-   function Get_15 (Arr : System.Address; N : Natural) return Bits_15 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_15
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_15
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_15;
 
    ------------
    -- Set_15 --
    ------------
 
-   procedure Set_15 (Arr : System.Address; N : Natural; E : Bits_15) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_15
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_15;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_15;
 
 end System.Pack_15;
index 62dc598e377b378efc9444d8b7848e1ff2824c35..787ca7ee7e31673b34f99198a4d1c2eb4541abbc 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_15 is
    type Bits_15 is mod 2 ** Bits;
    for Bits_15'Size use Bits;
 
-   function Get_15 (Arr : System.Address; N : Natural) return Bits_15;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_15
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_15 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_15 (Arr : System.Address; N : Natural; E : Bits_15);
+   procedure Set_15
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_15;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 755dd6b4bd976d60dd003bd091bce721fa88a16f..0fc493881bb2b41121923fdd004d7de345a5ce9c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_17 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_17 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_17 --
    ------------
 
-   function Get_17 (Arr : System.Address; N : Natural) return Bits_17 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_17
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_17
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_17;
 
    ------------
    -- Set_17 --
    ------------
 
-   procedure Set_17 (Arr : System.Address; N : Natural; E : Bits_17) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_17
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_17;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_17;
 
 end System.Pack_17;
index a81a696206ab435ba00157c228353768ebf17d59..9234b1e50082b7546b6740b7a4bf68a9ba36d5d7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_17 is
    type Bits_17 is mod 2 ** Bits;
    for Bits_17'Size use Bits;
 
-   function Get_17 (Arr : System.Address; N : Natural) return Bits_17;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_17
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_17 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_17 (Arr : System.Address; N : Natural; E : Bits_17);
+   procedure Set_17
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_17;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index feba763cd6d6d06f1fb32e0113b451a17cddd414..5e2e33f8602b858fe65575cc56e602893092b269 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_18 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_18 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_18 or SetU_18 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_18 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_18 --
    ------------
 
-   function Get_18 (Arr : System.Address; N : Natural) return Bits_18 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_18
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_18
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_18;
 
    -------------
    -- GetU_18 --
    -------------
 
-   function GetU_18 (Arr : System.Address; N : Natural) return Bits_18 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_18
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_18
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_18;
 
    ------------
    -- Set_18 --
    ------------
 
-   procedure Set_18 (Arr : System.Address; N : Natural; E : Bits_18) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_18
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_18;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_18;
 
    -------------
    -- SetU_18 --
    -------------
 
-   procedure SetU_18 (Arr : System.Address; N : Natural; E : Bits_18) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_18
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_18;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_18;
 
 end System.Pack_18;
index 31d6c0b3fc758adb019446bab0448f419e0baa04..051d992cbcceb7126723fbdcb63ea2ac128ed0d0 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_18 is
    type Bits_18 is mod 2 ** Bits;
    for Bits_18'Size use Bits;
 
-   function Get_18 (Arr : System.Address; N : Natural) return Bits_18;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_18
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_18 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_18 (Arr : System.Address; N : Natural; E : Bits_18);
+   procedure Set_18
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_18;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_18 (Arr : System.Address; N : Natural) return Bits_18;
+   function GetU_18
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_18 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_18 (Arr : System.Address; N : Natural; E : Bits_18);
+   procedure SetU_18
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_18;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 65d354017576a61a98b1a49192e5ddf879cac12e..3a9c2e7f6d283200c4578a8dac1467cbf2011553 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_19 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_19 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_19 --
    ------------
 
-   function Get_19 (Arr : System.Address; N : Natural) return Bits_19 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_19
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_19
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_19;
 
    ------------
    -- Set_19 --
    ------------
 
-   procedure Set_19 (Arr : System.Address; N : Natural; E : Bits_19) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_19
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_19;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_19;
 
 end System.Pack_19;
index 052c216ca6febc8b1c0b4276092b12d0baa44907..03dedb4f42613ef4a08f57a07b42fe7a2d1c9082 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_19 is
    type Bits_19 is mod 2 ** Bits;
    for Bits_19'Size use Bits;
 
-   function Get_19 (Arr : System.Address; N : Natural) return Bits_19;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_19
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_19 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_19 (Arr : System.Address; N : Natural; E : Bits_19);
+   procedure Set_19
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_19;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 6061588ca8856fdb5eef1c185ead742898af2edb..b0b9b4b4300a2c14d576489ebfa1526665dedf2e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_20 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_20 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_20 or SetU_20 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_20 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_20 --
    ------------
 
-   function Get_20 (Arr : System.Address; N : Natural) return Bits_20 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_20
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_20
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_20;
 
    -------------
    -- GetU_20 --
    -------------
 
-   function GetU_20 (Arr : System.Address; N : Natural) return Bits_20 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_20
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_20
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_20;
 
    ------------
    -- Set_20 --
    ------------
 
-   procedure Set_20 (Arr : System.Address; N : Natural; E : Bits_20) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_20
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_20;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_20;
 
    -------------
    -- SetU_20 --
    -------------
 
-   procedure SetU_20 (Arr : System.Address; N : Natural; E : Bits_20) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_20
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_20;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_20;
 
 end System.Pack_20;
index 800d677cd37a06e5bd42c3dc8fcfb0924492390b..e75f828f382f3a233c361ce7a2f1378c53a29755 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_20 is
    type Bits_20 is mod 2 ** Bits;
    for Bits_20'Size use Bits;
 
-   function Get_20 (Arr : System.Address; N : Natural) return Bits_20;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_20
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_20 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_20 (Arr : System.Address; N : Natural; E : Bits_20);
+   procedure Set_20
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_20;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_20 (Arr : System.Address; N : Natural) return Bits_20;
+   function GetU_20
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_20 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_20 (Arr : System.Address; N : Natural; E : Bits_20);
+   procedure SetU_20
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_20;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 6b78650934f36dab05432121d5d92a6a3a1d6b21..8357a699a7d612b6c99e779e582d24f0bc086803 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_21 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_21 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_21 --
    ------------
 
-   function Get_21 (Arr : System.Address; N : Natural) return Bits_21 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_21
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_21
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_21;
 
    ------------
    -- Set_21 --
    ------------
 
-   procedure Set_21 (Arr : System.Address; N : Natural; E : Bits_21) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_21
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_21;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_21;
 
 end System.Pack_21;
index a0d5939f0d6b249aad77f6ff051bf0143a7d2c67..0454df05b483fd493a211b91290e0756722bff20 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_21 is
    type Bits_21 is mod 2 ** Bits;
    for Bits_21'Size use Bits;
 
-   function Get_21 (Arr : System.Address; N : Natural) return Bits_21;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_21
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_21 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_21 (Arr : System.Address; N : Natural; E : Bits_21);
+   procedure Set_21
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_21;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index d0e3cdf7701fd0772b3a6c9ddfb66cdefc69834a..ae27d67d53bfbd1d4141b0302d1d118db6b6ae17 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_22 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_22 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_22 or SetU_22 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_22 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_22 --
    ------------
 
-   function Get_22 (Arr : System.Address; N : Natural) return Bits_22 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_22
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_22
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_22;
 
    -------------
    -- GetU_22 --
    -------------
 
-   function GetU_22 (Arr : System.Address; N : Natural) return Bits_22 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_22
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_22
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_22;
 
    ------------
    -- Set_22 --
    ------------
 
-   procedure Set_22 (Arr : System.Address; N : Natural; E : Bits_22) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_22
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_22;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_22;
 
    -------------
    -- SetU_22 --
    -------------
 
-   procedure SetU_22 (Arr : System.Address; N : Natural; E : Bits_22) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_22
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_22;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_22;
 
 end System.Pack_22;
index d4f1de78dfad42acee5f8454b5ba76927ec5ba82..7504ba8b83d1ad38c31a6edd507696308910edf9 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_22 is
    type Bits_22 is mod 2 ** Bits;
    for Bits_22'Size use Bits;
 
-   function Get_22 (Arr : System.Address; N : Natural) return Bits_22;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_22
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_22 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_22 (Arr : System.Address; N : Natural; E : Bits_22);
+   procedure Set_22
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_22;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_22 (Arr : System.Address; N : Natural) return Bits_22;
+   function GetU_22
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_22 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_22 (Arr : System.Address; N : Natural; E : Bits_22);
+   procedure SetU_22
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_22;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index ba14b3bfd0f3f0af701904538dce4c847d54d592..85f4af96a76897bf41c9c65e38bece465d975a98 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_23 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_23 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_23 --
    ------------
 
-   function Get_23 (Arr : System.Address; N : Natural) return Bits_23 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_23
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_23
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_23;
 
    ------------
    -- Set_23 --
    ------------
 
-   procedure Set_23 (Arr : System.Address; N : Natural; E : Bits_23) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_23
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_23;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_23;
 
 end System.Pack_23;
index eaa968ecea281df9eb48dd6649e6999076a817a7..9057453c1b2a6ddf9a64a63fb695283f9a02dc8d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_23 is
    type Bits_23 is mod 2 ** Bits;
    for Bits_23'Size use Bits;
 
-   function Get_23 (Arr : System.Address; N : Natural) return Bits_23;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_23
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_23 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_23 (Arr : System.Address; N : Natural; E : Bits_23);
+   procedure Set_23
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_23;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 49695e6233fada72a7d35313b4e1e9810800f0b9..96cbabf750cfccf92964a683dc7ec38bd55fda78 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_24 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_24 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_24 or SetU_24 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_24 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_24 --
    ------------
 
-   function Get_24 (Arr : System.Address; N : Natural) return Bits_24 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_24
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_24
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_24;
 
    -------------
    -- GetU_24 --
    -------------
 
-   function GetU_24 (Arr : System.Address; N : Natural) return Bits_24 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_24
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_24
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_24;
 
    ------------
    -- Set_24 --
    ------------
 
-   procedure Set_24 (Arr : System.Address; N : Natural; E : Bits_24) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_24
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_24;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_24;
 
    -------------
    -- SetU_24 --
    -------------
 
-   procedure SetU_24 (Arr : System.Address; N : Natural; E : Bits_24) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_24
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_24;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_24;
 
 end System.Pack_24;
index 440dc48678b7d1363797692558eddda543263e22..fde2fa3e666c7ad64a6fa93a7ed16b56dc4e4242 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_24 is
    type Bits_24 is mod 2 ** Bits;
    for Bits_24'Size use Bits;
 
-   function Get_24 (Arr : System.Address; N : Natural) return Bits_24;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_24
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_24 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_24 (Arr : System.Address; N : Natural; E : Bits_24);
+   procedure Set_24
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_24;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_24 (Arr : System.Address; N : Natural) return Bits_24;
+   function GetU_24
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_24 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_24 (Arr : System.Address; N : Natural; E : Bits_24);
+   procedure SetU_24
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_24;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 3d927c27e64f9840682ade3ee0329251dc928a19..e3df996ca4428d1e044204957dde2c73170ae9b9 100644 (file)
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_25 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_25 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_25 --
    ------------
 
-   function Get_25 (Arr : System.Address; N : Natural) return Bits_25 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_25
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_25
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_25;
 
    ------------
    -- Set_25 --
    ------------
 
-   procedure Set_25 (Arr : System.Address; N : Natural; E : Bits_25) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_25
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_25;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_25;
 
 end System.Pack_25;
index b7f3ebbf7e485c8523a60080776738e0d42bc569..d59beebd4bbcbf7bc5d64f800231b4fdb46a1cba 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_25 is
    type Bits_25 is mod 2 ** Bits;
    for Bits_25'Size use Bits;
 
-   function Get_25 (Arr : System.Address; N : Natural) return Bits_25;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_25
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_25 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_25 (Arr : System.Address; N : Natural; E : Bits_25);
+   procedure Set_25
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_25;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 613558f5367bab463904cba4e43a26d7d7e6fe00..d7edc149e726492b2ebc403aabc51ab8b27ae848 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_26 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_26 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_26 or SetU_26 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_26 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_26 --
    ------------
 
-   function Get_26 (Arr : System.Address; N : Natural) return Bits_26 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_26
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_26
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_26;
 
    -------------
    -- GetU_26 --
    -------------
 
-   function GetU_26 (Arr : System.Address; N : Natural) return Bits_26 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_26
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_26
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_26;
 
    ------------
    -- Set_26 --
    ------------
 
-   procedure Set_26 (Arr : System.Address; N : Natural; E : Bits_26) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_26
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_26;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_26;
 
    -------------
    -- SetU_26 --
    -------------
 
-   procedure SetU_26 (Arr : System.Address; N : Natural; E : Bits_26) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_26
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_26;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_26;
 
 end System.Pack_26;
index d0d56ac42080a870740957b0cf089465da268cf6..979e8927856e9901d64f33a9fa67ebddaff58ee2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_26 is
    type Bits_26 is mod 2 ** Bits;
    for Bits_26'Size use Bits;
 
-   function Get_26 (Arr : System.Address; N : Natural) return Bits_26;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_26
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_26 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_26 (Arr : System.Address; N : Natural; E : Bits_26);
+   procedure Set_26
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_26;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_26 (Arr : System.Address; N : Natural) return Bits_26;
+   function GetU_26
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_26 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_26 (Arr : System.Address; N : Natural; E : Bits_26);
+   procedure SetU_26
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_26;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 7497c098f8eccfffe1b0be4ec70552c9d98f86d5..0a15d878abc0febae0b8ed0b850697e647880298 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_27 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_27 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_27 --
    ------------
 
-   function Get_27 (Arr : System.Address; N : Natural) return Bits_27 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_27
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_27
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_27;
 
    ------------
    -- Set_27 --
    ------------
 
-   procedure Set_27 (Arr : System.Address; N : Natural; E : Bits_27) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_27
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_27;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_27;
 
 end System.Pack_27;
index bfb287e1d4bdaad66bc23b35dd7d880d8bd66d0c..da77d5746b6fc71c8962557455b10877b7519730 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_27 is
    type Bits_27 is mod 2 ** Bits;
    for Bits_27'Size use Bits;
 
-   function Get_27 (Arr : System.Address; N : Natural) return Bits_27;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_27
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_27 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_27 (Arr : System.Address; N : Natural; E : Bits_27);
+   procedure Set_27
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_27;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 1342885baf59cf3abe27eca5311faf74e389d7a5..35daf6d56e72ac6d6c9bfb05accfaf49d74b5be5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_28 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_28 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_28 or SetU_28 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_28 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_28 --
    ------------
 
-   function Get_28 (Arr : System.Address; N : Natural) return Bits_28 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_28
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_28
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_28;
 
    -------------
    -- GetU_28 --
    -------------
 
-   function GetU_28 (Arr : System.Address; N : Natural) return Bits_28 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_28
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_28
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_28;
 
    ------------
    -- Set_28 --
    ------------
 
-   procedure Set_28 (Arr : System.Address; N : Natural; E : Bits_28) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_28
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_28;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_28;
 
    -------------
    -- SetU_28 --
    -------------
 
-   procedure SetU_28 (Arr : System.Address; N : Natural; E : Bits_28) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_28
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_28;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_28;
 
 end System.Pack_28;
index 79c1751a48c8f0fcc69997e37b782bd50c61c6bd..996ff25a0fdb6de7aebaf79d9a8661f1e204a71e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_28 is
    type Bits_28 is mod 2 ** Bits;
    for Bits_28'Size use Bits;
 
-   function Get_28 (Arr : System.Address; N : Natural) return Bits_28;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_28
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_28 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_28 (Arr : System.Address; N : Natural; E : Bits_28);
+   procedure Set_28
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_28;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_28 (Arr : System.Address; N : Natural) return Bits_28;
+   function GetU_28
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_28 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_28 (Arr : System.Address; N : Natural; E : Bits_28);
+   procedure SetU_28
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_28;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index f0a54c13184ba2fc4e1d0a61a3d7d972e8640bcb..73bc62f36f3d8b977a0352d8e8264f1a99b6bcc7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_29 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_29 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_29 --
    ------------
 
-   function Get_29 (Arr : System.Address; N : Natural) return Bits_29 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_29
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_29
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_29;
 
    ------------
    -- Set_29 --
    ------------
 
-   procedure Set_29 (Arr : System.Address; N : Natural; E : Bits_29) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_29
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_29;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_29;
 
 end System.Pack_29;
index ea479574a3c437a726dffaf6601ec8d0aa381e11..47bcb234a8b4f4baaf5f7486a78f198a01727bee 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_29 is
    type Bits_29 is mod 2 ** Bits;
    for Bits_29'Size use Bits;
 
-   function Get_29 (Arr : System.Address; N : Natural) return Bits_29;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_29
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_29 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_29 (Arr : System.Address; N : Natural; E : Bits_29);
+   procedure Set_29
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_29;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 04eb5b3758a3fd509de4c30d66ed4a7f0c42772b..ceab502f7ca939195a61e521ec5499eeff98dcb6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_30 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_30 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_30 or SetU_30 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_30 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_30 --
    ------------
 
-   function Get_30 (Arr : System.Address; N : Natural) return Bits_30 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_30
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_30
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_30;
 
    -------------
    -- GetU_30 --
    -------------
 
-   function GetU_30 (Arr : System.Address; N : Natural) return Bits_30 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_30
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_30
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_30;
 
    ------------
    -- Set_30 --
    ------------
 
-   procedure Set_30 (Arr : System.Address; N : Natural; E : Bits_30) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_30
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_30;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_30;
 
    -------------
    -- SetU_30 --
    -------------
 
-   procedure SetU_30 (Arr : System.Address; N : Natural; E : Bits_30) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_30
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_30;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_30;
 
 end System.Pack_30;
index b09addfeb1b1d792d632f9c5bca218edd96741a1..aa8585018f5131033de1a522c1d6b0efa813196e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_30 is
    type Bits_30 is mod 2 ** Bits;
    for Bits_30'Size use Bits;
 
-   function Get_30 (Arr : System.Address; N : Natural) return Bits_30;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_30
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_30 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_30 (Arr : System.Address; N : Natural; E : Bits_30);
+   procedure Set_30
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_30;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_30 (Arr : System.Address; N : Natural) return Bits_30;
+   function GetU_30
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_30 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_30 (Arr : System.Address; N : Natural; E : Bits_30);
+   procedure SetU_30
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_30;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index d723601af2cd38932d51f8a982f083c4958abd7a..d0eada3337dceb76da6767a21f005c909f462624 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_31 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_31 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_31 --
    ------------
 
-   function Get_31 (Arr : System.Address; N : Natural) return Bits_31 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_31
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_31
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_31;
 
    ------------
    -- Set_31 --
    ------------
 
-   procedure Set_31 (Arr : System.Address; N : Natural; E : Bits_31) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_31
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_31;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_31;
 
 end System.Pack_31;
index 4cd0daf7a9179abeb2fb3d4977cfca394b500cda..5667e6fee59996f0de9207964979e9b870b5dc2c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_31 is
    type Bits_31 is mod 2 ** Bits;
    for Bits_31'Size use Bits;
 
-   function Get_31 (Arr : System.Address; N : Natural) return Bits_31;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_31
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_31 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_31 (Arr : System.Address; N : Natural; E : Bits_31);
+   procedure Set_31
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_31;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 745d8de0318aa3994a8a87373cac9b6271f8f9d3..0cbbf658d114be12f5692ee7722bec7a78d9ce28 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_33 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_33 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_33 --
    ------------
 
-   function Get_33 (Arr : System.Address; N : Natural) return Bits_33 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_33
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_33
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_33;
 
    ------------
    -- Set_33 --
    ------------
 
-   procedure Set_33 (Arr : System.Address; N : Natural; E : Bits_33) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_33
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_33;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_33;
 
 end System.Pack_33;
index a0dc085d558064e8818dc97aefdb7d7566ee145b..085298b10e6c2d685c924c84ff16342c911764fc 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_33 is
    type Bits_33 is mod 2 ** Bits;
    for Bits_33'Size use Bits;
 
-   function Get_33 (Arr : System.Address; N : Natural) return Bits_33;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_33
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_33 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_33 (Arr : System.Address; N : Natural; E : Bits_33);
+   procedure Set_33
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_33;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 8beafa918a2e8594af6a3913380bf1093ffe0a3b..b97c63d0689d3a9d54a31babf20d42fe104cfcba 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_34 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_34 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_34 or SetU_34 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_34 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_34 --
    ------------
 
-   function Get_34 (Arr : System.Address; N : Natural) return Bits_34 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_34
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_34
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_34;
 
    -------------
    -- GetU_34 --
    -------------
 
-   function GetU_34 (Arr : System.Address; N : Natural) return Bits_34 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_34
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_34
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_34;
 
    ------------
    -- Set_34 --
    ------------
 
-   procedure Set_34 (Arr : System.Address; N : Natural; E : Bits_34) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_34
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_34;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_34;
 
    -------------
    -- SetU_34 --
    -------------
 
-   procedure SetU_34 (Arr : System.Address; N : Natural; E : Bits_34) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_34
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_34;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_34;
 
 end System.Pack_34;
index 26dbc98740a3df5c4a53ef85825334f2696f68e4..668f8066cd8c1c3adff71dd34b4511cb09e0bb65 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_34 is
    type Bits_34 is mod 2 ** Bits;
    for Bits_34'Size use Bits;
 
-   function Get_34 (Arr : System.Address; N : Natural) return Bits_34;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_34
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_34 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_34 (Arr : System.Address; N : Natural; E : Bits_34);
+   procedure Set_34
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_34;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_34 (Arr : System.Address; N : Natural) return Bits_34;
+   function GetU_34
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_34 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_34 (Arr : System.Address; N : Natural; E : Bits_34);
+   procedure SetU_34
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_34;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 009e66707bf39092817717e4ef3a8f1e03616cff..98bbd8586c79532c5e50ae96f5b66c0e074f796d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_35 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_35 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_35 --
    ------------
 
-   function Get_35 (Arr : System.Address; N : Natural) return Bits_35 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_35
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_35
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_35;
 
    ------------
    -- Set_35 --
    ------------
 
-   procedure Set_35 (Arr : System.Address; N : Natural; E : Bits_35) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_35
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_35;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_35;
 
 end System.Pack_35;
index 17283a95498c31ffae81396b4ff76f675fca84f1..a1e8e0c3c9d34ff54b1058c0663f89b9b98a03e3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_35 is
    type Bits_35 is mod 2 ** Bits;
    for Bits_35'Size use Bits;
 
-   function Get_35 (Arr : System.Address; N : Natural) return Bits_35;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_35
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_35 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_35 (Arr : System.Address; N : Natural; E : Bits_35);
+   procedure Set_35
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_35;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index bfd3e55ef30e1b04c4d946be65b15f05cb91485a..9303a5084870ddabb9ca6a3dc0c473d8888ca7f5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_36 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_36 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_36 or SetU_36 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_36 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_36 --
    ------------
 
-   function Get_36 (Arr : System.Address; N : Natural) return Bits_36 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_36
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_36
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_36;
 
    -------------
    -- GetU_36 --
    -------------
 
-   function GetU_36 (Arr : System.Address; N : Natural) return Bits_36 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_36
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_36
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_36;
 
    ------------
    -- Set_36 --
    ------------
 
-   procedure Set_36 (Arr : System.Address; N : Natural; E : Bits_36) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_36
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_36;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_36;
 
    -------------
    -- SetU_36 --
    -------------
 
-   procedure SetU_36 (Arr : System.Address; N : Natural; E : Bits_36) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_36
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_36;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_36;
 
 end System.Pack_36;
index 17633fad10e7420300eddd084787da18976485b2..456c7fa967c34c02e77349e23d80392565464c94 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_36 is
    type Bits_36 is mod 2 ** Bits;
    for Bits_36'Size use Bits;
 
-   function Get_36 (Arr : System.Address; N : Natural) return Bits_36;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_36
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_36 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_36 (Arr : System.Address; N : Natural; E : Bits_36);
+   procedure Set_36
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_36;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_36 (Arr : System.Address; N : Natural) return Bits_36;
+   function GetU_36
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_36 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_36 (Arr : System.Address; N : Natural; E : Bits_36);
+   procedure SetU_36
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_36;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 374ecdefaeab372ba5fb8dfe2c614a1d6b7a8e01..ec4a21ac77dd0a8e64fc6b0e91a7dcecebb5d09e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_37 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_37 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_37 --
    ------------
 
-   function Get_37 (Arr : System.Address; N : Natural) return Bits_37 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_37
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_37
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_37;
 
    ------------
    -- Set_37 --
    ------------
 
-   procedure Set_37 (Arr : System.Address; N : Natural; E : Bits_37) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_37
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_37;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_37;
 
 end System.Pack_37;
index baa44c6fa60886a91beff4269a781faeb8c7e914..8b8084346be7ba4767f25665b04b435f50dec463 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_37 is
    type Bits_37 is mod 2 ** Bits;
    for Bits_37'Size use Bits;
 
-   function Get_37 (Arr : System.Address; N : Natural) return Bits_37;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_37
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_37 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_37 (Arr : System.Address; N : Natural; E : Bits_37);
+   procedure Set_37
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_37;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 90cf4c43019679ecc59a8b03a0f7a8f3816ec367..b12166ebfc91a2e098819a75e96785b99d638141 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_38 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_38 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_38 or SetU_38 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_38 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_38 --
    ------------
 
-   function Get_38 (Arr : System.Address; N : Natural) return Bits_38 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_38
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_38
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_38;
 
    -------------
    -- GetU_38 --
    -------------
 
-   function GetU_38 (Arr : System.Address; N : Natural) return Bits_38 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_38
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_38
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_38;
 
    ------------
    -- Set_38 --
    ------------
 
-   procedure Set_38 (Arr : System.Address; N : Natural; E : Bits_38) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_38
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_38;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_38;
 
    -------------
    -- SetU_38 --
    -------------
 
-   procedure SetU_38 (Arr : System.Address; N : Natural; E : Bits_38) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_38
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_38;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_38;
 
 end System.Pack_38;
index b246eec7abb1f39b52b4154db84a6eb00e4d6f4a..f2a98891c0bd8369c9232f949dbb00bd0b45e235 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_38 is
    type Bits_38 is mod 2 ** Bits;
    for Bits_38'Size use Bits;
 
-   function Get_38 (Arr : System.Address; N : Natural) return Bits_38;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_38
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_38 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_38 (Arr : System.Address; N : Natural; E : Bits_38);
+   procedure Set_38
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_38;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_38 (Arr : System.Address; N : Natural) return Bits_38;
+   function GetU_38
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_38 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_38 (Arr : System.Address; N : Natural; E : Bits_38);
+   procedure SetU_38
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_38;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 2583191138812edf37330602cb900aa5e309594e..85c942a64147c53373650f615373696ee89b36fe 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_39 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_39 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_39 --
    ------------
 
-   function Get_39 (Arr : System.Address; N : Natural) return Bits_39 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_39
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_39
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_39;
 
    ------------
    -- Set_39 --
    ------------
 
-   procedure Set_39 (Arr : System.Address; N : Natural; E : Bits_39) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_39
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_39;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_39;
 
 end System.Pack_39;
index 90c4eaabad0b64eb47e8b20068e0660dd45372fe..8ba083db4df3f86332bbae7df30772d36172d997 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_39 is
    type Bits_39 is mod 2 ** Bits;
    for Bits_39'Size use Bits;
 
-   function Get_39 (Arr : System.Address; N : Natural) return Bits_39;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_39
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_39 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_39 (Arr : System.Address; N : Natural; E : Bits_39);
+   procedure Set_39
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_39;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 7267631206690b6f2a0322479bf24f40b5082896..993fc95dce7852e8854060771528099d9e7209e2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_40 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_40 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_40 or SetU_40 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_40 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_40 --
    ------------
 
-   function Get_40 (Arr : System.Address; N : Natural) return Bits_40 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_40
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_40
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_40;
 
    -------------
    -- GetU_40 --
    -------------
 
-   function GetU_40 (Arr : System.Address; N : Natural) return Bits_40 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_40
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_40
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_40;
 
    ------------
    -- Set_40 --
    ------------
 
-   procedure Set_40 (Arr : System.Address; N : Natural; E : Bits_40) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_40
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_40;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_40;
 
    -------------
    -- SetU_40 --
    -------------
 
-   procedure SetU_40 (Arr : System.Address; N : Natural; E : Bits_40) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_40
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_40;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_40;
 
 end System.Pack_40;
index 9fd948ecf94c4f5bebe1ae11bcf723742e1a5727..1f30ee358ceb19dc3578553ce3c91b571dead2ad 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_40 is
    type Bits_40 is mod 2 ** Bits;
    for Bits_40'Size use Bits;
 
-   function Get_40 (Arr : System.Address; N : Natural) return Bits_40;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_40
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_40 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_40 (Arr : System.Address; N : Natural; E : Bits_40);
+   procedure Set_40
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_40;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_40 (Arr : System.Address; N : Natural) return Bits_40;
+   function GetU_40
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_40 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_40 (Arr : System.Address; N : Natural; E : Bits_40);
+   procedure SetU_40
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_40;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 7ace35884552e93991a51003e82dd294cc141322..dd580c06fa50fb33cdc071c9dacffa6be8cf617f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_41 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_41 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_41 --
    ------------
 
-   function Get_41 (Arr : System.Address; N : Natural) return Bits_41 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_41
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_41
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_41;
 
    ------------
    -- Set_41 --
    ------------
 
-   procedure Set_41 (Arr : System.Address; N : Natural; E : Bits_41) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_41
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_41;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_41;
 
 end System.Pack_41;
index 2ff9f511059e3dfbcf188ffe97addb4322f2a3fe..8dcae701a0c541c6f64f330eed3eed6cc380b5e5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_41 is
    type Bits_41 is mod 2 ** Bits;
    for Bits_41'Size use Bits;
 
-   function Get_41 (Arr : System.Address; N : Natural) return Bits_41;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_41
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_41 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_41 (Arr : System.Address; N : Natural; E : Bits_41);
+   procedure Set_41
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_41;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 6ba6567b28492582a623c03dcec4a28e5e44cc98..bc8285a53d5d9e74f15bbd166da7af8f9516c421 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_42 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_42 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_42 or SetU_42 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_42 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_42 --
    ------------
 
-   function Get_42 (Arr : System.Address; N : Natural) return Bits_42 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_42
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_42
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_42;
 
    -------------
    -- GetU_42 --
    -------------
 
-   function GetU_42 (Arr : System.Address; N : Natural) return Bits_42 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_42
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_42
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_42;
 
    ------------
    -- Set_42 --
    ------------
 
-   procedure Set_42 (Arr : System.Address; N : Natural; E : Bits_42) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_42
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_42;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_42;
 
    -------------
    -- SetU_42 --
    -------------
 
-   procedure SetU_42 (Arr : System.Address; N : Natural; E : Bits_42) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_42
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_42;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_42;
 
 end System.Pack_42;
index a0740b26592958cc8ea7701d96dfed50771bc891..73872fd1dd299ccf9efc53f582960a04e69e0851 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_42 is
    type Bits_42 is mod 2 ** Bits;
    for Bits_42'Size use Bits;
 
-   function Get_42 (Arr : System.Address; N : Natural) return Bits_42;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_42
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_42 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_42 (Arr : System.Address; N : Natural; E : Bits_42);
+   procedure Set_42
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_42;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_42 (Arr : System.Address; N : Natural) return Bits_42;
+   function GetU_42
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_42 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_42 (Arr : System.Address; N : Natural; E : Bits_42);
+   procedure SetU_42
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_42;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 7979fb13a911a812843d99ddadc73a44e83fd423..509cb006ef79deb27d124902c57dd1af5161c29c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_43 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_43 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_43 --
    ------------
 
-   function Get_43 (Arr : System.Address; N : Natural) return Bits_43 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_43
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_43
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_43;
 
    ------------
    -- Set_43 --
    ------------
 
-   procedure Set_43 (Arr : System.Address; N : Natural; E : Bits_43) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_43
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_43;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_43;
 
 end System.Pack_43;
index 99202f2c83ac0a2e23966bbf27fc89efe3cc8049..f82678f6efdde4da3b670bfa0222c982c3ea553d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_43 is
    type Bits_43 is mod 2 ** Bits;
    for Bits_43'Size use Bits;
 
-   function Get_43 (Arr : System.Address; N : Natural) return Bits_43;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_43
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_43 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_43 (Arr : System.Address; N : Natural; E : Bits_43);
+   procedure Set_43
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_43;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index a3f7f001b0081be29f3c0b975940c6fa40ef777f..f7fe185573a40812fb1fb6847ec1a859afb40808 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_44 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_44 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_44 or SetU_44 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_44 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_44 --
    ------------
 
-   function Get_44 (Arr : System.Address; N : Natural) return Bits_44 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_44
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_44
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_44;
 
    -------------
    -- GetU_44 --
    -------------
 
-   function GetU_44 (Arr : System.Address; N : Natural) return Bits_44 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_44
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_44
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_44;
 
    ------------
    -- Set_44 --
    ------------
 
-   procedure Set_44 (Arr : System.Address; N : Natural; E : Bits_44) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_44
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_44;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_44;
 
    -------------
    -- SetU_44 --
    -------------
 
-   procedure SetU_44 (Arr : System.Address; N : Natural; E : Bits_44) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_44
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_44;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_44;
 
 end System.Pack_44;
index d083bf2acbde1b61c4a11e87cead8e32219b0ba2..89b3f3e747e680d11b9193b3d6ea53f7425fe465 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_44 is
    type Bits_44 is mod 2 ** Bits;
    for Bits_44'Size use Bits;
 
-   function Get_44 (Arr : System.Address; N : Natural) return Bits_44;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_44
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_44 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_44 (Arr : System.Address; N : Natural; E : Bits_44);
+   procedure Set_44
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_44;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_44 (Arr : System.Address; N : Natural) return Bits_44;
+   function GetU_44
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_44 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_44 (Arr : System.Address; N : Natural; E : Bits_44);
+   procedure SetU_44
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_44;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 4a2ce84afc1fa16287f66b99c7f92aff07f84ed8..2247312e77a0e17dcec00fcce8a5d81be77d0785 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_45 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_45 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_45 --
    ------------
 
-   function Get_45 (Arr : System.Address; N : Natural) return Bits_45 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_45
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_45
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_45;
 
    ------------
    -- Set_45 --
    ------------
 
-   procedure Set_45 (Arr : System.Address; N : Natural; E : Bits_45) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_45
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_45;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_45;
 
 end System.Pack_45;
index 2c9b60b88ceaaf0700494bd2264f1caddccaccde..2340d48fb231b1a480c5da71068c7af660a903c8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_45 is
    type Bits_45 is mod 2 ** Bits;
    for Bits_45'Size use Bits;
 
-   function Get_45 (Arr : System.Address; N : Natural) return Bits_45;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_45
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_45 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_45 (Arr : System.Address; N : Natural; E : Bits_45);
+   procedure Set_45
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_45;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 7df5199e6020a4139d7c3e6e45f6f131aea2963c..c2b45f054df46e87c3ba9ef1b3a01d61566f5ccd 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_46 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_46 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_46 or SetU_46 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_46 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_46 --
    ------------
 
-   function Get_46 (Arr : System.Address; N : Natural) return Bits_46 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_46
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_46
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_46;
 
    -------------
    -- GetU_46 --
    -------------
 
-   function GetU_46 (Arr : System.Address; N : Natural) return Bits_46 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_46
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_46
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_46;
 
    ------------
    -- Set_46 --
    ------------
 
-   procedure Set_46 (Arr : System.Address; N : Natural; E : Bits_46) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_46
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_46;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_46;
 
    -------------
    -- SetU_46 --
    -------------
 
-   procedure SetU_46 (Arr : System.Address; N : Natural; E : Bits_46) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_46
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_46;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_46;
 
 end System.Pack_46;
index 5cdc6a2a2162e67ed15b9385f1b31f3e8f606635..6ab8dfe5cccddae6bfbaddab200e0fe3bb5fe313 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_46 is
    type Bits_46 is mod 2 ** Bits;
    for Bits_46'Size use Bits;
 
-   function Get_46 (Arr : System.Address; N : Natural) return Bits_46;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_46
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_46 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_46 (Arr : System.Address; N : Natural; E : Bits_46);
+   procedure Set_46
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_46;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_46 (Arr : System.Address; N : Natural) return Bits_46;
+   function GetU_46
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_46 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_46 (Arr : System.Address; N : Natural; E : Bits_46);
+   procedure SetU_46
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_46;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 1cd3d7f624d3361465ace7de18ae507a10c8035d..d63e35df5741c3af1f4bd11f5f5e3ae7919646bf 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_47 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_47 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_47 --
    ------------
 
-   function Get_47 (Arr : System.Address; N : Natural) return Bits_47 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_47
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_47
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_47;
 
    ------------
    -- Set_47 --
    ------------
 
-   procedure Set_47 (Arr : System.Address; N : Natural; E : Bits_47) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_47
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_47;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_47;
 
 end System.Pack_47;
index c44a251f6899f07eb426620583f840d53b3a1c33..f924965b3eb92097a88808b4f52da80b64e1c545 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_47 is
    type Bits_47 is mod 2 ** Bits;
    for Bits_47'Size use Bits;
 
-   function Get_47 (Arr : System.Address; N : Natural) return Bits_47;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_47
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_47 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_47 (Arr : System.Address; N : Natural; E : Bits_47);
+   procedure Set_47
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_47;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 615c27014990e8f65c884abebdcffe9e67f3a479..780a15793d5ff8cec9f811a90dd680ddbfe64d12 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_48 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_48 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_48 or SetU_48 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_48 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_48 --
    ------------
 
-   function Get_48 (Arr : System.Address; N : Natural) return Bits_48 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_48
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_48
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_48;
 
    -------------
    -- GetU_48 --
    -------------
 
-   function GetU_48 (Arr : System.Address; N : Natural) return Bits_48 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_48
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_48
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_48;
 
    ------------
    -- Set_48 --
    ------------
 
-   procedure Set_48 (Arr : System.Address; N : Natural; E : Bits_48) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_48
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_48;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_48;
 
    -------------
    -- SetU_48 --
    -------------
 
-   procedure SetU_48 (Arr : System.Address; N : Natural; E : Bits_48) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_48
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_48;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_48;
 
 end System.Pack_48;
index f91b7949f7df210a40701a3bd20275edf8459afd..ba1008e68b7c92778a56eb54873e80b8fd5ec5fe 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_48 is
    type Bits_48 is mod 2 ** Bits;
    for Bits_48'Size use Bits;
 
-   function Get_48 (Arr : System.Address; N : Natural) return Bits_48;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_48
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_48 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_48 (Arr : System.Address; N : Natural; E : Bits_48);
+   procedure Set_48
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_48;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_48 (Arr : System.Address; N : Natural) return Bits_48;
+   function GetU_48
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_48 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_48 (Arr : System.Address; N : Natural; E : Bits_48);
+   procedure SetU_48
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_48;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 9e912035fb7c14a37b58201bd087c3fdbae162ac..a9cad23681060e1998ac26d38783a20504acac8d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_49 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_49 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_49 --
    ------------
 
-   function Get_49 (Arr : System.Address; N : Natural) return Bits_49 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_49
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_49
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_49;
 
    ------------
    -- Set_49 --
    ------------
 
-   procedure Set_49 (Arr : System.Address; N : Natural; E : Bits_49) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_49
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_49;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_49;
 
 end System.Pack_49;
index b0ba1f1827b44cf672805b7eb35105e3a58f9f0b..649e550231388fc4d2a9819aed2aa8052b70db74 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_49 is
    type Bits_49 is mod 2 ** Bits;
    for Bits_49'Size use Bits;
 
-   function Get_49 (Arr : System.Address; N : Natural) return Bits_49;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_49
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_49 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_49 (Arr : System.Address; N : Natural; E : Bits_49);
+   procedure Set_49
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_49;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index fb2dc15c068afd63b068602f2adfbad7c58a0ad6..7cc04e69dacbd5cd53b73a9bc520585e798faa6b 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_50 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_50 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_50 or SetU_50 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_50 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_50 --
    ------------
 
-   function Get_50 (Arr : System.Address; N : Natural) return Bits_50 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_50
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_50
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_50;
 
    -------------
    -- GetU_50 --
    -------------
 
-   function GetU_50 (Arr : System.Address; N : Natural) return Bits_50 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_50
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_50
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_50;
 
    ------------
    -- Set_50 --
    ------------
 
-   procedure Set_50 (Arr : System.Address; N : Natural; E : Bits_50) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_50
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_50;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_50;
 
    -------------
    -- SetU_50 --
    -------------
 
-   procedure SetU_50 (Arr : System.Address; N : Natural; E : Bits_50) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_50
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_50;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_50;
 
 end System.Pack_50;
index 1399b66e3c33c0198191e2f0460f40c742f8f737..699165b49a7dec6328dbfcfcfdae6387fc0c612e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_50 is
    type Bits_50 is mod 2 ** Bits;
    for Bits_50'Size use Bits;
 
-   function Get_50 (Arr : System.Address; N : Natural) return Bits_50;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_50
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_50 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_50 (Arr : System.Address; N : Natural; E : Bits_50);
+   procedure Set_50
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_50;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_50 (Arr : System.Address; N : Natural) return Bits_50;
+   function GetU_50
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_50 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_50 (Arr : System.Address; N : Natural; E : Bits_50);
+   procedure SetU_50
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_50;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index f8e4d99a2abbfbf65b774c115256e1d535691065..5617a983ae7302b374dd8d616bde159b8bf923f4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_51 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_51 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_51 --
    ------------
 
-   function Get_51 (Arr : System.Address; N : Natural) return Bits_51 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_51
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_51
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_51;
 
    ------------
    -- Set_51 --
    ------------
 
-   procedure Set_51 (Arr : System.Address; N : Natural; E : Bits_51) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_51
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_51;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_51;
 
 end System.Pack_51;
index 8e4316c3dbeddcaea80904ca568d30f244f1c384..99bdd51226703d36bdb6e1dfaa86304fcaa7c8a6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_51 is
    type Bits_51 is mod 2 ** Bits;
    for Bits_51'Size use Bits;
 
-   function Get_51 (Arr : System.Address; N : Natural) return Bits_51;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_51
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_51 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_51 (Arr : System.Address; N : Natural; E : Bits_51);
+   procedure Set_51
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_51;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 6c4fd40580a4a4cfe343901bcc1460f1232e5f59..5adf132af9e4444303fe23f0419069c6706bb6f3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_52 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_52 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_52 or SetU_52 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_52 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_52 --
    ------------
 
-   function Get_52 (Arr : System.Address; N : Natural) return Bits_52 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_52
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_52
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_52;
 
    -------------
    -- GetU_52 --
    -------------
 
-   function GetU_52 (Arr : System.Address; N : Natural) return Bits_52 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_52
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_52
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_52;
 
    ------------
    -- Set_52 --
    ------------
 
-   procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_52
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_52;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_52;
 
    -------------
    -- SetU_52 --
    -------------
 
-   procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_52
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_52;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_52;
 
 end System.Pack_52;
index 1342a92600e2be3328e7423dd0196317d5295c99..fab35eecc5d29db25a5ad17c54a74202dc9040a5 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_52 is
    type Bits_52 is mod 2 ** Bits;
    for Bits_52'Size use Bits;
 
-   function Get_52 (Arr : System.Address; N : Natural) return Bits_52;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_52
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_52 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52);
+   procedure Set_52
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_52;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_52 (Arr : System.Address; N : Natural) return Bits_52;
+   function GetU_52
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_52 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52);
+   procedure SetU_52
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_52;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index c19512b17ce4ffb75773e270efe892e560fb689e..471d1fc1c2c3bd334c1279b9a32632a897145fe8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_53 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_53 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_53 --
    ------------
 
-   function Get_53 (Arr : System.Address; N : Natural) return Bits_53 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_53
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_53
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_53;
 
    ------------
    -- Set_53 --
    ------------
 
-   procedure Set_53 (Arr : System.Address; N : Natural; E : Bits_53) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_53
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_53;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_53;
 
 end System.Pack_53;
index e0e568386967113361fb6547e20db3eed560cfb5..380278c2eefd9f8c3d62d868db484988299a8b3f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_53 is
    type Bits_53 is mod 2 ** Bits;
    for Bits_53'Size use Bits;
 
-   function Get_53 (Arr : System.Address; N : Natural) return Bits_53;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_53
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_53 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_53 (Arr : System.Address; N : Natural; E : Bits_53);
+   procedure Set_53
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_53;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index d21dbc0dfdf96d69198cbe89683d8a68208c73de..5d0294178e7079bc65da62e53bb321e2d3d2ab6c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_54 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_54 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_54 or SetU_54 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_54 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_54 --
    ------------
 
-   function Get_54 (Arr : System.Address; N : Natural) return Bits_54 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_54
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_54
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_54;
 
    -------------
    -- GetU_54 --
    -------------
 
-   function GetU_54 (Arr : System.Address; N : Natural) return Bits_54 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_54
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_54
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_54;
 
    ------------
    -- Set_54 --
    ------------
 
-   procedure Set_54 (Arr : System.Address; N : Natural; E : Bits_54) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_54
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_54;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_54;
 
    -------------
    -- SetU_54 --
    -------------
 
-   procedure SetU_54 (Arr : System.Address; N : Natural; E : Bits_54) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_54
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_54;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_54;
 
 end System.Pack_54;
index 448f6dbc5f37a750c1ac2eef9b4c09ccf690e117..5ee9a88667835d80515a10427d2de6c65e6b5008 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_54 is
    type Bits_54 is mod 2 ** Bits;
    for Bits_54'Size use Bits;
 
-   function Get_54 (Arr : System.Address; N : Natural) return Bits_54;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_54
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_54 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_54 (Arr : System.Address; N : Natural; E : Bits_54);
+   procedure Set_54
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_54;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_54 (Arr : System.Address; N : Natural) return Bits_54;
+   function GetU_54
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_54 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_54 (Arr : System.Address; N : Natural; E : Bits_54);
+   procedure SetU_54
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_54;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 378d6f22a4f46a4b6ce09cf523509ed32e1c7011..be264e1318f22af3867320cd52945fe06574c705 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_55 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_55 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_55 --
    ------------
 
-   function Get_55 (Arr : System.Address; N : Natural) return Bits_55 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_55
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_55
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_55;
 
    ------------
    -- Set_55 --
    ------------
 
-   procedure Set_55 (Arr : System.Address; N : Natural; E : Bits_55) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_55
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_55;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_55;
 
 end System.Pack_55;
index 00d4d93d99f52d9328dc1b9d1befadd5a34c54da..8dce9fa71417d609781fd4e5b43e55a0aa596e05 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_55 is
    type Bits_55 is mod 2 ** Bits;
    for Bits_55'Size use Bits;
 
-   function Get_55 (Arr : System.Address; N : Natural) return Bits_55;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_55
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_55 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_55 (Arr : System.Address; N : Natural; E : Bits_55);
+   procedure Set_55
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_55;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index b27c408e36775752a8ec954092a26172dbad3719..fd34211bf37bea93b9c4fd568099f870f3744cbb 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_56 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_56 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_56 or SetU_56 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_56 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_56 --
    ------------
 
-   function Get_56 (Arr : System.Address; N : Natural) return Bits_56 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_56
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_56
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_56;
 
    -------------
    -- GetU_56 --
    -------------
 
-   function GetU_56 (Arr : System.Address; N : Natural) return Bits_56 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_56
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_56
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_56;
 
    ------------
    -- Set_56 --
    ------------
 
-   procedure Set_56 (Arr : System.Address; N : Natural; E : Bits_56) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_56
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_56;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_56;
 
    -------------
    -- SetU_56 --
    -------------
 
-   procedure SetU_56 (Arr : System.Address; N : Natural; E : Bits_56) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_56
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_56;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_56;
 
 end System.Pack_56;
index 27c593c1e66e96e6243dfaded74b9367383b622e..5e6578bb50c187d477613141ef122849f12dcb6f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_56 is
    type Bits_56 is mod 2 ** Bits;
    for Bits_56'Size use Bits;
 
-   function Get_56 (Arr : System.Address; N : Natural) return Bits_56;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_56
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_56 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_56 (Arr : System.Address; N : Natural; E : Bits_56);
+   procedure Set_56
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_56;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_56 (Arr : System.Address; N : Natural) return Bits_56;
+   function GetU_56
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_56 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_56 (Arr : System.Address; N : Natural; E : Bits_56);
+   procedure SetU_56
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_56;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index c510baf2b24cd7e76b445d47a6428941e1ec9767..b477b2e558922f09c1dcb2495c490221d7402458 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_57 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_57 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_57 --
    ------------
 
-   function Get_57 (Arr : System.Address; N : Natural) return Bits_57 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_57
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_57
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_57;
 
    ------------
    -- Set_57 --
    ------------
 
-   procedure Set_57 (Arr : System.Address; N : Natural; E : Bits_57) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_57
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_57;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_57;
 
 end System.Pack_57;
index 5203deaaab73febfb59de16eb1f4265f9700d969..aff3c500c338b3d1137229bca9dd3251774c3f7f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_57 is
    type Bits_57 is mod 2 ** Bits;
    for Bits_57'Size use Bits;
 
-   function Get_57 (Arr : System.Address; N : Natural) return Bits_57;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_57
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_57 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_57 (Arr : System.Address; N : Natural; E : Bits_57);
+   procedure Set_57
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_57;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 067928c643650369ad5d83b9d4be097d7cbe8ca9..1aeb45003fe93bd68105fad0107e18a37329cff6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_58 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_58 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_58 or SetU_58 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_58 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_58 --
    ------------
 
-   function Get_58 (Arr : System.Address; N : Natural) return Bits_58 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_58
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_58
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_58;
 
    -------------
    -- GetU_58 --
    -------------
 
-   function GetU_58 (Arr : System.Address; N : Natural) return Bits_58 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_58
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_58
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_58;
 
    ------------
    -- Set_58 --
    ------------
 
-   procedure Set_58 (Arr : System.Address; N : Natural; E : Bits_58) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_58
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_58;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_58;
 
    -------------
    -- SetU_58 --
    -------------
 
-   procedure SetU_58 (Arr : System.Address; N : Natural; E : Bits_58) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_58
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_58;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_58;
 
 end System.Pack_58;
index a7e31c7cc6ddbbdde547c79540e293412eb8fa2b..503d990e0e9aaf0b7bb0e1994473f3ad2bc83c2a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_58 is
    type Bits_58 is mod 2 ** Bits;
    for Bits_58'Size use Bits;
 
-   function Get_58 (Arr : System.Address; N : Natural) return Bits_58;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_58
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_58 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_58 (Arr : System.Address; N : Natural; E : Bits_58);
+   procedure Set_58
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_58;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_58 (Arr : System.Address; N : Natural) return Bits_58;
+   function GetU_58
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_58 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_58 (Arr : System.Address; N : Natural; E : Bits_58);
+   procedure SetU_58
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_58;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index ea93ebff57004b7067a27131951c168159030b7f..35199ce47bdaded0e8d5d89eafc3a0d74a47563d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_59 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_59 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_59 --
    ------------
 
-   function Get_59 (Arr : System.Address; N : Natural) return Bits_59 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_59
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_59
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_59;
 
    ------------
    -- Set_59 --
    ------------
 
-   procedure Set_59 (Arr : System.Address; N : Natural; E : Bits_59) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_59
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_59;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_59;
 
 end System.Pack_59;
index 585ecd9c5bfb8f77ec1f3503c6a697318db99ad0..2abbbf2efc32741d68701877f1bb82cf35338bf6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_59 is
    type Bits_59 is mod 2 ** Bits;
    for Bits_59'Size use Bits;
 
-   function Get_59 (Arr : System.Address; N : Natural) return Bits_59;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_59
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_59 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_59 (Arr : System.Address; N : Natural; E : Bits_59);
+   procedure Set_59
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_59;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index 5ade775071dfb83c366f6478c62763e2ffc33b66..e909f71b6a96f6bbda3dd355f40a9bd1146c488c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_60 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_60 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_60 or SetU_60 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_60 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_60 --
    ------------
 
-   function Get_60 (Arr : System.Address; N : Natural) return Bits_60 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_60
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_60
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_60;
 
    -------------
    -- GetU_60 --
    -------------
 
-   function GetU_60 (Arr : System.Address; N : Natural) return Bits_60 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_60
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_60
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_60;
 
    ------------
    -- Set_60 --
    ------------
 
-   procedure Set_60 (Arr : System.Address; N : Natural; E : Bits_60) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_60
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_60;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_60;
 
    -------------
    -- SetU_60 --
    -------------
 
-   procedure SetU_60 (Arr : System.Address; N : Natural; E : Bits_60) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_60
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_60;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_60;
 
 end System.Pack_60;
index cee776b78315120668bc4c7dec299fdf07749f73..bc4886878ed9c43958e903c1161836ed9e677d23 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_60 is
    type Bits_60 is mod 2 ** Bits;
    for Bits_60'Size use Bits;
 
-   function Get_60 (Arr : System.Address; N : Natural) return Bits_60;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_60
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_60 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_60 (Arr : System.Address; N : Natural; E : Bits_60);
+   procedure Set_60
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_60;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_60 (Arr : System.Address; N : Natural) return Bits_60;
+   function GetU_60
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_60 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_60 (Arr : System.Address; N : Natural; E : Bits_60);
+   procedure SetU_60
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_60;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index 27f72e4127caaba500edd8e3493d8c9567bd246e..cd29c81294d3761a7a045e48233e1e9f2d03808c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_61 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_61 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_61 --
    ------------
 
-   function Get_61 (Arr : System.Address; N : Natural) return Bits_61 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_61
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_61
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_61;
 
    ------------
    -- Set_61 --
    ------------
 
-   procedure Set_61 (Arr : System.Address; N : Natural; E : Bits_61) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_61
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_61;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_61;
 
 end System.Pack_61;
index 0d63baefd7df54cd917957a1b433634473003acd..ac309a230f8e831639ebaed7001d80333fbfd9d3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_61 is
    type Bits_61 is mod 2 ** Bits;
    for Bits_61'Size use Bits;
 
-   function Get_61 (Arr : System.Address; N : Natural) return Bits_61;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_61
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_61 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_61 (Arr : System.Address; N : Natural; E : Bits_61);
+   procedure Set_61
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_61;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index faac2115cc2b91aca3e16470bce7e6416fd31ac3..b13754df5c739392ff7b30500eb3c26f1281d315 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_62 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,8 +71,10 @@ package body System.Pack_62 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    --  The following declarations are for the case where the address
    --  passed to GetU_62 or SetU_62 is not guaranteed to be aligned.
@@ -81,83 +86,165 @@ package body System.Pack_62 is
 
    type ClusterU_Ref is access ClusterU;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, ClusterU_Ref);
+   type Rev_ClusterU is new ClusterU
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_ClusterU_Ref is access Rev_ClusterU;
 
    ------------
    -- Get_62 --
    ------------
 
-   function Get_62 (Arr : System.Address; N : Natural) return Bits_62 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_62
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_62
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_62;
 
    -------------
    -- GetU_62 --
    -------------
 
-   function GetU_62 (Arr : System.Address; N : Natural) return Bits_62 is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function GetU_62
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_62
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end GetU_62;
 
    ------------
    -- Set_62 --
    ------------
 
-   procedure Set_62 (Arr : System.Address; N : Natural; E : Bits_62) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_62
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_62;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_62;
 
    -------------
    -- SetU_62 --
    -------------
 
-   procedure SetU_62 (Arr : System.Address; N : Natural; E : Bits_62) is
-      C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure SetU_62
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_62;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : ClusterU_Ref     with Address => A'Address, Import;
+      RC : Rev_ClusterU_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end SetU_62;
 
 end System.Pack_62;
index 89ad4469a04e638e1f32f38c23583189317c9146..b8b19f4a4f14448bcca4732619f7d3b543821a41 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,20 +39,37 @@ package System.Pack_62 is
    type Bits_62 is mod 2 ** Bits;
    for Bits_62'Size use Bits;
 
-   function Get_62 (Arr : System.Address; N : Natural) return Bits_62;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_62
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_62 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_62 (Arr : System.Address; N : Natural; E : Bits_62);
+   procedure Set_62
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_62;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
-   function GetU_62 (Arr : System.Address; N : Natural) return Bits_62;
+   function GetU_62
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_62 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned. This version
    --  is used when Arr may represent an unaligned address.
 
-   procedure SetU_62 (Arr : System.Address; N : Natural; E : Bits_62);
+   procedure SetU_62
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_62;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value. This version
    --  is used when Arr may represent an unaligned address
index c6faee6fbf8f36b33573fc126478b1d22f087fcd..109f914b9b31968959e17ea1144d654177ecd5bc 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
 
 with System.Storage_Elements;
 with System.Unsigned_Types;
-with Ada.Unchecked_Conversion;
 
 package body System.Pack_63 is
 
+   subtype Bit_Order is System.Bit_Order;
+   Reverse_Bit_Order : constant Bit_Order :=
+     Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order));
+
    subtype Ofs is System.Storage_Elements.Storage_Offset;
    subtype Uns is System.Unsigned_Types.Unsigned;
    subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7;
@@ -68,45 +71,87 @@ package body System.Pack_63 is
 
    type Cluster_Ref is access Cluster;
 
-   function To_Ref is new
-     Ada.Unchecked_Conversion (System.Address, Cluster_Ref);
+   type Rev_Cluster is new Cluster
+     with Bit_Order            => Reverse_Bit_Order,
+          Scalar_Storage_Order => Reverse_Bit_Order;
+   type Rev_Cluster_Ref is access Rev_Cluster;
 
    ------------
    -- Get_63 --
    ------------
 
-   function Get_63 (Arr : System.Address; N : Natural) return Bits_63 is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   function Get_63
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_63
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => return C.E0;
-         when 1 => return C.E1;
-         when 2 => return C.E2;
-         when 3 => return C.E3;
-         when 4 => return C.E4;
-         when 5 => return C.E5;
-         when 6 => return C.E6;
-         when 7 => return C.E7;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => return RC.E0;
+            when 1 => return RC.E1;
+            when 2 => return RC.E2;
+            when 3 => return RC.E3;
+            when 4 => return RC.E4;
+            when 5 => return RC.E5;
+            when 6 => return RC.E6;
+            when 7 => return RC.E7;
+         end case;
+
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => return C.E0;
+            when 1 => return C.E1;
+            when 2 => return C.E2;
+            when 3 => return C.E3;
+            when 4 => return C.E4;
+            when 5 => return C.E5;
+            when 6 => return C.E6;
+            when 7 => return C.E7;
+         end case;
+      end if;
    end Get_63;
 
    ------------
    -- Set_63 --
    ------------
 
-   procedure Set_63 (Arr : System.Address; N : Natural; E : Bits_63) is
-      C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
+   procedure Set_63
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_63;
+      Rev_SSO : Boolean)
+   is
+      A  : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8);
+      C  : Cluster_Ref     with Address => A'Address, Import;
+      RC : Rev_Cluster_Ref with Address => A'Address, Import;
    begin
-      case N07 (Uns (N) mod 8) is
-         when 0 => C.E0 := E;
-         when 1 => C.E1 := E;
-         when 2 => C.E2 := E;
-         when 3 => C.E3 := E;
-         when 4 => C.E4 := E;
-         when 5 => C.E5 := E;
-         when 6 => C.E6 := E;
-         when 7 => C.E7 := E;
-      end case;
+      if Rev_SSO then
+         case N07 (Uns (N) mod 8) is
+            when 0 => RC.E0 := E;
+            when 1 => RC.E1 := E;
+            when 2 => RC.E2 := E;
+            when 3 => RC.E3 := E;
+            when 4 => RC.E4 := E;
+            when 5 => RC.E5 := E;
+            when 6 => RC.E6 := E;
+            when 7 => RC.E7 := E;
+         end case;
+      else
+         case N07 (Uns (N) mod 8) is
+            when 0 => C.E0 := E;
+            when 1 => C.E1 := E;
+            when 2 => C.E2 := E;
+            when 3 => C.E3 := E;
+            when 4 => C.E4 := E;
+            when 5 => C.E5 := E;
+            when 6 => C.E6 := E;
+            when 7 => C.E7 := E;
+         end case;
+      end if;
    end Set_63;
 
 end System.Pack_63;
index b76eed0efd6ed307713a5e75e5fe29ad36274639..c59678b4cd4cffa6282b00840d75895fcfbb03f7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -39,11 +39,21 @@ package System.Pack_63 is
    type Bits_63 is mod 2 ** Bits;
    for Bits_63'Size use Bits;
 
-   function Get_63 (Arr : System.Address; N : Natural) return Bits_63;
+   --  In all subprograms below, Rev_SSO is set True if the array has the
+   --  non-default scalar storage order.
+
+   function Get_63
+     (Arr     : System.Address;
+      N       : Natural;
+      Rev_SSO : Boolean) return Bits_63 with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is extracted and returned.
 
-   procedure Set_63 (Arr : System.Address; N : Natural; E : Bits_63);
+   procedure Set_63
+     (Arr     : System.Address;
+      N       : Natural;
+      E       : Bits_63;
+      Rev_SSO : Boolean) with Inline;
    --  Arr is the address of the packed array, N is the zero-based
    --  subscript. This element is set to the given value.
 
index f454a1e56e56207394af44cc1dbe7966fbfa1ab1..85b119b1d82b8a61b9d2d04d161f944ef0be98a0 100644 (file)
@@ -3521,7 +3521,7 @@ package body Sem_Ch13 is
       ------------------------------
 
       procedure Check_Indexing_Functions is
-         Indexing_Found : Boolean;
+         Indexing_Found : Boolean := False;
 
          procedure Check_One_Function (Subp : Entity_Id);
          --  Check one possible interpretation. Sets Indexing_Found True if a
index a713057db211b498a5a608d7ed3134b28c7b3175..16dc5342c6fe60f84256a5f96d0831070c9f1268 100644 (file)
@@ -10323,6 +10323,8 @@ package body Sem_Ch3 is
 
    procedure Check_Initialization (T : Entity_Id; Exp : Node_Id) is
    begin
+      --  Special processing for limited types
+
       if Is_Limited_Type (T)
         and then not In_Instance
         and then not In_Inlined_Body
@@ -10376,6 +10378,16 @@ package body Sem_Ch3 is
             end if;
          end if;
       end if;
+
+      --  In gnatc or gnatprove mode, make sure set Do_Range_Check flag gets
+      --  set unless we can be sure that no range check is required.
+
+      if (not Expander_Active and not GNATprove_Mode)
+        and then Is_Scalar_Type (T)
+        and then not Is_In_Range (Exp, T, Assume_Valid => True)
+      then
+         Set_Do_Range_Check (Exp);
+      end if;
    end Check_Initialization;
 
    ----------------------
@@ -18034,6 +18046,8 @@ package body Sem_Ch3 is
          if Present (Expression (Discr)) then
             Preanalyze_Spec_Expression (Expression (Discr), Discr_Type);
 
+            --  Legaity checks
+
             if Nkind (N) = N_Formal_Type_Declaration then
                Error_Msg_N
                  ("discriminant defaults not allowed for formal type",
@@ -18078,6 +18092,19 @@ package body Sem_Ch3 is
                  (Defining_Identifier (Discr), Expression (Discr));
             end if;
 
+            --  In gnatc or gnatprove mode, make sure set Do_Range_Check flag
+            --  gets set unless we can be sure that no range check is required.
+
+            if (not Expander_Active and not GNATprove_Mode)
+              and then not
+                Is_In_Range
+                  (Expression (Discr), Discr_Type, Assume_Valid => True)
+            then
+               Set_Do_Range_Check (Expression (Discr));
+            end if;
+
+         --  No default discriminant value given
+
          else
             Default_Not_Present := True;
          end if;
index 3e5458f2982c588f9199a3db614e1e572efbdd8f..30bad6d42852af7d5b6f8e3281f90d97b9d6d6be 100644 (file)
@@ -6079,9 +6079,18 @@ package body Sem_Eval is
       --  to get the information in the variable case as well.
 
    begin
+      --  Expression that raises constraint error is an odd case. We certainly
+      --  do not want to consider it to be in range. It might make sense to
+      --  consider it always out of range, but this causes incorrect error
+      --  messages about static expressions out of range. So we just return
+      --  Unknown, which is always safe.
+
+      if Raises_Constraint_Error (N) then
+         return Unknown;
+
       --  Universal types have no range limits, so always in range
 
-      if Typ = Universal_Integer or else Typ = Universal_Real then
+      elsif Typ = Universal_Integer or else Typ = Universal_Real then
          return In_Range;
 
       --  Never known if not scalar type. Don't know if this can actually
@@ -6099,14 +6108,10 @@ package body Sem_Eval is
       elsif Is_Generic_Type (Typ) then
          return Unknown;
 
-      --  Never known unless we have a compile time known value
+      --  Case of a known compile time value, where we can check if it is in
+      --  the bounds of the given type.
 
-      elsif not Compile_Time_Known_Value (N) then
-         return Unknown;
-
-      --  General processing with a known compile time value
-
-      else
+      elsif Compile_Time_Known_Value (N) then
          declare
             Lo       : Node_Id;
             Hi       : Node_Id;
@@ -6172,6 +6177,20 @@ package body Sem_Eval is
                end if;
             end if;
          end;
+
+      --  Here for value not known at compile time. Case of expression subtype
+      --  is Typ or is a subtype of Typ, and we can assume expression is valid.
+      --  In this case we know it is in range without knowing its value.
+
+      elsif Assume_Valid
+        and then (Etype (N) = Typ or else Is_Subtype_Of (Etype (N), Typ))
+      then
+         return In_Range;
+
+      --  For all other cases, result is unknown
+
+      else
+         return Unknown;
       end if;
    end Test_In_Range;
 
index 9f20397b32f6e7732029211abc50523d0564bf52..8921d6570937a1beb76b6686475c90c2bc911571 100644 (file)
@@ -1061,7 +1061,9 @@ package Sinfo is
    --      Initialization expression for the initial value in an object
    --      declaration. In this case the Do_Range_Check flag is set on
    --      the initialization expression, and the check is against the
-   --      range of the type of the object being declared.
+   --      range of the type of the object being declared. This includes the
+   --      cases of expressions providing default discriminant values, and
+   --      expressions used to initialize record components.
 
    --      The expression of a type conversion. In this case the range check is
    --      against the target type of the conversion. See also the use of