PR ipa/83051
[official-gcc.git] / gcc / testsuite / gnat.dg / inline1_pkg.adb
blob957971d5f86e1f42e4817ea9eb1e6f890daa01ed
1 with Ada.Unchecked_Conversion;
3 package body Inline1_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 Inline1_Pkg;