Since U1 is a signed integer type (defined using range
), its base type U1'Base will be roughly symmetrical around zero, including as a minimum the range -1 .. 1
. On most systems, a suitable hardware type will be selected, typically one byte, -128 .. 127
, or the equivalent of Interfaces.Integer_8. This base type is likely to be used as the representation of components of type U1 in the absence of any representation clauses.
When you need specific representations in Ada, you should say so:
type U1 is mod 2 with Size => 1;
type U1array is array (Index) of U1 with Component_Size => U1'Size, Size => Index'Last + 1;
The compiler will then use one bit per value in the array, packed to the bit level.
Note that the Pack aspect is only a compiler hint; the compiler is free to ignore it or to pack things less fully than possible. Size and Component_Size, on the other hand, must be obeyed fully or rejected if the compiler cannot do so.