1 /* s_copysignl.c -- long double version of s_copysign.c.
2 * Conversion to long double by Ulrich Drepper,
3 * Cygnus Support, drepper@cygnus.com.
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
10 * Developed at SunPro, a Sun Microsystems, Inc. business.
11 * Permission to use, copy, modify, and distribute this
12 * software is freely granted, provided that this notice
14 * ====================================================
18 * copysignl(long double x, long double y)
19 * copysignl(x,y) returns a value with the magnitude of x and
20 * with the sign bit of y.
26 #if __FLOAT_WORD_ORDER == BIG_ENDIAN
34 unsigned int empty
:16;
38 } ieee_long_double_shape_type
;
42 #if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
52 unsigned int empty
:16;
54 } ieee_long_double_shape_type
;
58 /* Get int from the exponent of a long double. */
60 #define GET_LDOUBLE_EXP(exp,d) \
62 ieee_long_double_shape_type ge_u; \
64 (exp) = ge_u.parts.sign_exponent; \
67 /* Set exponent of a long double from an int. */
69 #define SET_LDOUBLE_EXP(d,exp) \
71 ieee_long_double_shape_type se_u; \
73 se_u.parts.sign_exponent = (exp); \
77 long double copysignl(long double x
, long double y
);
78 libc_hidden_proto(copysignl
);
80 long double copysignl(long double x
, long double y
)
83 GET_LDOUBLE_EXP(es1
,x
);
84 GET_LDOUBLE_EXP(es2
,y
);
85 SET_LDOUBLE_EXP(x
,(es1
&0x7fff)|(es2
&0x8000));
89 libc_hidden_def(copysignl
);