8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libbc / libc / gen / common / _Qquad.h
blobd506e0ae70ded049e276e42e235158d5c0756b5b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1989 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _QUAD_INCLUDED_
28 #define _QUAD_INCLUDED_ /* Render harmless multiple inclusions. */
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Header file for long double == quadruple-precision run-time support. C
34 * "long double" and Fortran "real*16" are implemented identically on all
35 * architectures.
37 * Thus the quad run-time support is intentionally coded as C-callable routines
38 * for portability.
40 * Mixed-case identifiers with leading _ are intentionally chosen to minimize
41 * conflicts with user-defined C and Fortran identifiers.
44 #include <math.h> /* to get float macros */
46 #ifdef __STDC__ /* are we there yet */
48 #define QUAD long double
49 #define SINGLE float
50 #define SINGLERESULT float
51 #define RETURNSINGLE(x) return x
52 #define ASSIGNSINGLERESULT(x,y) x = y
54 #else
56 struct quadstruct {
57 unsigned parts[4]
60 #define QUAD struct quadstruct
62 #define SINGLE FLOATPARAMETER
63 #define SINGLERESULT FLOATFUNCTIONTYPE
64 #define RETURNSINGLE(x) RETURNFLOAT(x)
65 #define ASSIGNSINGLERESULT(x,y) {SINGLERESULT _kug = y; *(int *)&x = *(int*)&_kug;}
67 #endif
69 /****** Phase I Quad support: C run-time in libc/crt *****/
71 extern QUAD _Q_neg(QUAD); /* returns -x */
72 extern QUAD _Q_add(QUAD, QUAD); /* returns x + y */
73 extern QUAD _Q_sub(QUAD, QUAD); /* returns x - y */
74 extern QUAD _Q_mul(QUAD, QUAD); /* returns x * y */
75 extern QUAD _Q_div(QUAD, QUAD); /* returns x / y */
76 extern QUAD _Q_sqrt(QUAD); /* return sqrt(x) */
77 extern enum fcc_type
78 _Q_cmp(QUAD, QUAD); /* x compare y , exception */
79 /* only on signaling NaN */
80 extern enum fcc_type
81 _Q_cmpe(QUAD, QUAD); /* x compare y , exception */
82 /* on quiet NaN */
83 extern int _Q_feq(QUAD, QUAD); /* return TRUE if x == y */
84 extern int _Q_fne(QUAD, QUAD); /* return TRUE if x != y */
85 extern int _Q_fgt(QUAD, QUAD); /* return TRUE if x > y */
86 extern int _Q_fge(QUAD, QUAD); /* return TRUE if x >= y */
87 extern int _Q_flt(QUAD, QUAD); /* return TRUE if x < y */
88 extern int _Q_fle(QUAD, QUAD); /* return TRUE if x <= y */
90 /* Conversion routines are pretty straightforward. */
92 extern QUAD _Q_stoq(SINGLE);
93 extern QUAD _Q_dtoq(double);
94 extern QUAD _Q_itoq(int);
95 extern QUAD _Q_utoq(unsigned);
96 extern SINGLERESULT _Q_qtos(QUAD);
97 extern double _Q_qtod(QUAD);
98 extern int _Q_qtoi(QUAD);
99 extern unsigned _Q_qtou(QUAD);
101 /******
102 Phase I Quad support: scanf/printf support in libc/gen/common
103 *****/
105 enum fcc_type /* relationships for loading into cc */
107 fcc_equal = 0,
108 fcc_less = 1,
109 fcc_greater = 2,
110 fcc_unordered = 3
113 typedef /* FPU register viewed as single components. */
114 struct
116 unsigned sign : 1 ;
117 unsigned exponent : 8 ;
118 unsigned significand : 23 ;
120 single_type ;
122 typedef /* FPU register viewed as double components. */
123 struct
125 unsigned sign : 1 ;
126 unsigned exponent : 11 ;
127 unsigned significand : 20 ;
129 double_type ;
130 typedef /* FPU register viewed as extended components. */
131 struct
133 unsigned sign : 1 ;
134 unsigned exponent : 15 ;
135 unsigned significand : 16 ;
137 extended_type ;
139 enum fp_op_type /* Type specifiers in FPU instructions. */
141 fp_op_integer = 0, /* Not in hardware, but convenient to define. */
142 fp_op_single = 1,
143 fp_op_double = 2,
144 fp_op_extended = 3
148 extern void _Q_get_rp_rd(void);
149 extern void _Q_set_exception(unsigned);
151 #endif /* QUAD_INCLUDED */