2002-04-02 David S. Miller <davem@redhat.com>
[official-gcc.git] / gcc / ada / s-fatgen.ads
blob0f886814b1c875ef3a7de0e1e06a953798fcb644
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . F A T _ G E N --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This generic package provides a target independent implementation of the
36 -- floating-point attributes that denote functions. The implementations here
37 -- are portable, but very slow. The runtime contains a set of instantiations
38 -- of this package for all predefined floating-point types, and these should
39 -- be replaced by efficient assembly language code where possible.
41 generic
42 type T is digits <>;
44 package System.Fat_Gen is
45 pragma Pure (Fat_Gen);
47 subtype UI is Integer;
48 -- The runtime representation of universal integer for the purposes of
49 -- this package is integer. The expander generates conversions for the
50 -- actual type used. For functions returning universal integer, there
51 -- is no problem, since the result always is in range of integer. For
52 -- input arguments, the expander has to do some special casing to deal
53 -- with the (very annoying!) cases of out of range values. If we used
54 -- Long_Long_Integer to represent universal, then there would be no
55 -- problem, but the resulting inefficiency would be annoying.
57 function Adjacent (X, Towards : T) return T;
59 function Ceiling (X : T) return T;
61 function Compose (Fraction : T; Exponent : UI) return T;
63 function Copy_Sign (Value, Sign : T) return T;
65 function Exponent (X : T) return UI;
67 function Floor (X : T) return T;
69 function Fraction (X : T) return T;
71 function Leading_Part (X : T; Radix_Digits : UI) return T;
73 function Machine (X : T) return T;
75 function Model (X : T) return T;
77 function Pred (X : T) return T;
79 function Remainder (X, Y : T) return T;
81 function Rounding (X : T) return T;
83 function Scaling (X : T; Adjustment : UI) return T;
85 function Succ (X : T) return T;
87 function Truncation (X : T) return T;
89 function Unbiased_Rounding (X : T) return T;
91 function Valid (X : access T) return Boolean;
92 -- This function checks if the object of type T referenced by X
93 -- is valid, and returns True/False accordingly. The parameter is
94 -- passed by reference (access) here, as the object of type T may
95 -- be an abnormal value that cannot be passed in a floating-point
96 -- register, and the whole point of 'Valid is to prevent exceptions.
98 private
99 pragma Inline (Machine);
100 pragma Inline (Model);
101 pragma Inline_Always (Valid);
103 end System.Fat_Gen;