4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #ifndef _COMPLEX_WRAPPER_H
31 #define _COMPLEX_WRAPPER_H
33 #pragma ident "@(#)complex_wrapper.h 1.7 06/01/31 SMI"
36 #define dcomplex double _Complex
37 #define fcomplex float _Complex
38 #define ldcomplex long double _Complex
39 #define D_RE(x) __real__ x
40 #define D_IM(x) __imag__ x
41 #define F_RE(x) __real__ x
42 #define F_IM(x) __imag__ x
43 #define LD_RE(x) __real__ x
44 #define LD_IM(x) __imag__ x
49 #define dcomplex double complex
50 #define fcomplex float complex
51 #define ldcomplex long double complex
52 #define _X_RE(__t, __z) ((__t *) &__z)[0]
53 #define _X_IM(__t, __z) ((__t *) &__z)[1]
54 #define D_RE(__z) _X_RE(double, __z)
55 #define D_IM(__z) _X_IM(double, __z)
56 #define F_RE(__z) _X_RE(float, __z)
57 #define F_IM(__z) _X_IM(float, __z)
58 #define LD_RE(__z) _X_RE(long double, __z)
59 #define LD_IM(__z) _X_IM(long double, __z)
67 #define HI_XWORD(x) ((unsigned *) &x)[0]
68 #define XFSCALE(x, n) ((unsigned *) &x)[0] += n << 16 /* signbitl(x) == 0 */
69 #define CHOPPED(x) ((long double) ((double) (x)))
73 #define HI_XWORD(x) ((((int *) &x)[2] << 16) | \
74 (0xffff & ((unsigned *) &x)[1] >> 15))
75 #define XFSCALE(x, n) ((unsigned short *) &x)[4] += n /* signbitl(x) == 0 */
76 #define CHOPPED(x) ((long double) ((float) (x)))
78 #error Unknown architecture
80 #define HI_WORD(x) ((int *) &x)[HIWORD] /* for double */
81 #define LO_WORD(x) ((int *) &x)[LOWORD] /* for double */
82 #define THE_WORD(x) ((int *) &x)[0] /* for float */
85 * iy:ly must have the sign bit already cleared
87 #define ISINF(iy, ly) (((iy - 0x7ff00000) | ly) == 0)
89 #endif /* _COMPLEX_WRAPPER_H */