Commit 6027ad8b by Gary Dismukes Committed by Arnaud Charlet

s-veboop.adb (SU): New named number initialized to System.Storage_Unit.

2007-08-14  Gary Dismukes  <dismukes@adacore.com>

	* 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.

From-SVN: r127465
parent 20dedfc1
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- 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 -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -33,24 +33,30 @@ ...@@ -33,24 +33,30 @@
package body System.Vectors.Boolean_Operations is 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; type Boolean_Array is array (Integer range <>) of Boolean;
pragma Assert (Boolean_Array'Component_Size = 8); pragma Compile_Time_Error
-- Unfortunately Boolean_Array'Component_Size is not a compile-time-known (Boolean_Array'Component_Size /= SU, "run time compile failure");
-- value, so assume it is 8 in order to be able to determine True_Val at
-- compile time.
-- NOTE: The boolean literals must be qualified here to avoid visibility -- NOTE: The boolean literals must be qualified here to avoid visibility
-- anomalies when this package is compiled through Rtsfind, in a context -- anomalies when this package is compiled through Rtsfind, in a context
-- that includes a user-defined type derived from boolean. -- that includes a user-defined type derived from boolean.
True_Val : constant Vector := Standard.True'Enum_Rep True_Val : constant Vector := Standard.True'Enum_Rep
+ Standard.True'Enum_Rep * 2**8 + Standard.True'Enum_Rep * 2**SU
+ Standard.True'Enum_Rep * 2**(8 * 2) + Standard.True'Enum_Rep * 2**(SU * 2)
+ Standard.True'Enum_Rep * 2**(8 * 3) + Standard.True'Enum_Rep * 2**(SU * 3)
+ Standard.True'Enum_Rep * 2**(8 * 4) + Standard.True'Enum_Rep * 2**(SU * 4)
+ Standard.True'Enum_Rep * 2**(8 * 5) + Standard.True'Enum_Rep * 2**(SU * 5)
+ Standard.True'Enum_Rep * 2**(8 * 6) + Standard.True'Enum_Rep * 2**(SU * 6)
+ Standard.True'Enum_Rep * 2**(8 * 7); + Standard.True'Enum_Rep * 2**(SU * 7);
-- This constant represents the bits to be flipped to perform a logical -- This constant represents the bits to be flipped to perform a logical
-- "not" on a vector of booleans, independent of the actual -- "not" on a vector of booleans, independent of the actual
-- representation of True. -- representation of True.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment