2 -- { dg-options "-O2 -gnato -fdump-tree-optimized" }
6 function To_Unchecked
(Bits
: T_Bit_Array
) return Unsigned32
is
7 Value
: Unsigned32
:= 0;
9 for I
in Bits
'Range loop
10 Value
:= Value
* 2 + Unsigned32
(Bits
(I
));
15 function To_Scalar
(Bits
: T_Bit_Array
) return Positive is
19 Tmp
:= To_Unchecked
(Bits
);
20 if Tmp
in 0 .. Unsigned32
(Positive'last) then
21 Value
:= Positive (Tmp
);
23 Value
:= -Positive (Unsigned32
'last - Tmp
);
24 if Value
> Positive'first then
33 function Func
(Bit_Array
: T_Bit_Array
;
34 Bit_Index
: T_Bit_Index
) return Positive is
36 return To_Scalar
(Bit_Array
(Bit_Index
.. Bit_Index
+ 1));
41 -- { dg-final { scan-tree-dump-not "alloca" "optimized" } }