From a6145fd327879338fdf4059e5d317030ed8b89b9 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 14 Aug 2007 08:50:18 +0000 Subject: [PATCH] 2007-08-14 Gary Dismukes * s-veboop.adb (SU): New named number initialized to System.Storage_Unit. (True_Val): The initialization expression is revised to use SU (= Storage_Unit) rather than assuming 8 for the component size of an unpacked Boolean array. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127465 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/s-veboop.adb | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/gcc/ada/s-veboop.adb b/gcc/ada/s-veboop.adb index 177a944..27f68a2 100644 --- a/gcc/ada/s-veboop.adb +++ b/gcc/ada/s-veboop.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 2002-2007, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -33,24 +33,30 @@ package body System.Vectors.Boolean_Operations is + SU : constant := Storage_Unit; + -- Convenient short hand, used throughout + + -- The coding of this unit depends on the fact that the Component_Size + -- of a normally declared array of Boolean is equal to Storage_Unit. We + -- can't use the Component_Size directly since it is non-static. The + -- following declaration checks that this declaration is correct + type Boolean_Array is array (Integer range <>) of Boolean; - pragma Assert (Boolean_Array'Component_Size = 8); - -- Unfortunately Boolean_Array'Component_Size is not a compile-time-known - -- value, so assume it is 8 in order to be able to determine True_Val at - -- compile time. + pragma Compile_Time_Error + (Boolean_Array'Component_Size /= SU, "run time compile failure"); -- NOTE: The boolean literals must be qualified here to avoid visibility -- anomalies when this package is compiled through Rtsfind, in a context -- that includes a user-defined type derived from boolean. True_Val : constant Vector := Standard.True'Enum_Rep - + Standard.True'Enum_Rep * 2**8 - + Standard.True'Enum_Rep * 2**(8 * 2) - + Standard.True'Enum_Rep * 2**(8 * 3) - + Standard.True'Enum_Rep * 2**(8 * 4) - + Standard.True'Enum_Rep * 2**(8 * 5) - + Standard.True'Enum_Rep * 2**(8 * 6) - + Standard.True'Enum_Rep * 2**(8 * 7); + + Standard.True'Enum_Rep * 2**SU + + Standard.True'Enum_Rep * 2**(SU * 2) + + Standard.True'Enum_Rep * 2**(SU * 3) + + Standard.True'Enum_Rep * 2**(SU * 4) + + Standard.True'Enum_Rep * 2**(SU * 5) + + Standard.True'Enum_Rep * 2**(SU * 6) + + Standard.True'Enum_Rep * 2**(SU * 7); -- This constant represents the bits to be flipped to perform a logical -- "not" on a vector of booleans, independent of the actual -- representation of True. -- 2.7.4