2016-01-15 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / inline2_pkg.adb
blob539b4a5e87dbf54fac3c24da644ccc1894f1822c
1 with Ada.Unchecked_Conversion;
3 package body Inline2_Pkg is
5 type Ieee_Short_Real is
6 record
7 Mantisse_Sign : Integer range 0 .. 1;
8 Exponent : Integer range 0 .. 2 ** 8 - 1;
9 Mantisse : Integer range 0 .. 2 ** 23 - 1;
10 end record;
12 for Ieee_Short_Real use
13 record
14 Mantisse_Sign at 0 range 31 .. 31;
15 Exponent at 0 range 23 .. 30;
16 Mantisse at 0 range 0 .. 22;
17 end record;
19 function Valid_Real (Number : Float) return Boolean is
20 function To_Ieee_Short_Real is
21 new Ada.Unchecked_Conversion (Float, Ieee_Short_Real);
22 begin
23 return To_Ieee_Short_Real (Number).Exponent /= 255;
24 end Valid_Real;
26 function Invalid_Real return Float is
27 function To_Float is
28 new Ada.Unchecked_Conversion (Ieee_Short_Real, Float);
29 begin
30 return To_Float (Ieee_Short_Real'(Mantisse_Sign => 0,
31 Exponent => 255, Mantisse => 0));
32 end Invalid_Real;
34 end Inline2_Pkg;