3 with Ada
.Unchecked_Conversion
;
4 with Ada
.Streams
; use Ada
.Streams
;
5 with Ada
.Text_IO
; use Ada
.Text_IO
;
7 procedure Unchecked_Convert2
is
9 subtype Day_Number
is Integer range 0 .. 31;
11 subtype Byte_Array_Of_Integer
is Stream_Element_Array
12 (1 .. Integer'Size / Stream_Element_Array
'Component_Size);
14 function To_Byte_Array
is
15 new Ada
.Unchecked_Conversion
(Integer, Byte_Array_Of_Integer
);
18 Pragma Volatile
(Day_Now
);
20 Arr
: Stream_Element_Array
(1 .. 12) := (others => 16#ff#
);
22 procedure Test
(Arr
: Stream_Element_Array
) is
24 if Arr
(5) /= 0 or Arr
(6) /= 0 or Arr
(7) /= 0 or Arr
(8) /= 0 then
31 Arr
(5 .. 8) := To_Byte_Array
(Day_Now
);
34 end Unchecked_Convert2
;