/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994-1997, by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _QUAD_H
#define _QUAD_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Common definitions for quadruple precision emulation routines
* (SPARC only)
*/
/* macros to simplify dealing with the diferences between V8 and V9 */
#ifdef __sparcv9
#define Z (*pz)
#define QUAD_RETURN(x) return
#else
#define Z z
#define QUAD_RETURN(x) return (x)
#endif
/* fsr definitions */
/* current exception bits */
/* accrued exception bits */
/* trap enable bits */
/* rounding directions (shifted) */
#define FSR_RN 0
/*
* in struct longdouble, msw implicitly consists of
* unsigned short sign:1;
* unsigned short exponent:15;
* unsigned short frac1:16;
*/
/* structure used to access words within a quad */
union longdouble {
struct {
unsigned int msw;
unsigned int frac2;
unsigned int frac3;
unsigned int frac4;
} l;
long double d; /* unused; just guarantees correct alignment */
};
/* macros used internally for readability */
#define QUAD_ISNAN(x) \
#define QUAD_ISZERO(x) \
/* structure used to access words within a double */
union xdouble {
struct {
unsigned int hi;
unsigned int lo;
} l;
double d;
};
/* relationships returned by _Q_cmp and _Q_cmpe */
enum fcc_type {
fcc_equal = 0,
};
/* internal routines */
extern void __quad_mag_add(const union longdouble *,
const union longdouble *, union longdouble *, unsigned int *);
extern void __quad_mag_sub(const union longdouble *,
const union longdouble *, union longdouble *, unsigned int *);
/* inline templates */
extern void __quad_getfsrp(unsigned int *);
extern void __quad_setfsrp(const unsigned int *);
extern double __quad_dp_sqrt(double *);
union longdouble *);
union longdouble *);
union longdouble *);
union longdouble *);
unsigned int *);
unsigned int *);
extern void __quad_fstoq(const float *, union longdouble *);
extern void __quad_fdtoq(const double *, union longdouble *);
extern void __quad_fqtoi(const union longdouble *, int *);
extern void __quad_fqtos(const union longdouble *, float *);
extern void __quad_fqtod(const union longdouble *, double *);
#ifdef __sparcv9
extern void __quad_fqtox(const union longdouble *, long *);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _QUAD_H */