1*181254a7Smrg /* s_copysignl.c -- long double version of s_copysign.c.
2*181254a7Smrg * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
3*181254a7Smrg */
4*181254a7Smrg
5*181254a7Smrg /*
6*181254a7Smrg * ====================================================
7*181254a7Smrg * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8*181254a7Smrg *
9*181254a7Smrg * Developed at SunPro, a Sun Microsystems, Inc. business.
10*181254a7Smrg * Permission to use, copy, modify, and distribute this
11*181254a7Smrg * software is freely granted, provided that this notice
12*181254a7Smrg * is preserved.
13*181254a7Smrg * ====================================================
14*181254a7Smrg */
15*181254a7Smrg
16*181254a7Smrg #if defined(LIBM_SCCS) && !defined(lint)
17*181254a7Smrg static char rcsid[] = "NetBSD: ";
18*181254a7Smrg #endif
19*181254a7Smrg
20*181254a7Smrg /*
21*181254a7Smrg * copysignq(long double x, long double y)
22*181254a7Smrg * copysignq(x,y) returns a value with the magnitude of x and
23*181254a7Smrg * with the sign bit of y.
24*181254a7Smrg */
25*181254a7Smrg
26*181254a7Smrg #define NO_MATH_REDIRECT
27*181254a7Smrg
28*181254a7Smrg #include "quadmath-imp.h"
29*181254a7Smrg
copysignq(__float128 x,__float128 y)30*181254a7Smrg __float128 copysignq(__float128 x, __float128 y)
31*181254a7Smrg {
32*181254a7Smrg uint64_t hx,hy;
33*181254a7Smrg GET_FLT128_MSW64(hx,x);
34*181254a7Smrg GET_FLT128_MSW64(hy,y);
35*181254a7Smrg SET_FLT128_MSW64(x,(hx&0x7fffffffffffffffULL)
36*181254a7Smrg |(hy&0x8000000000000000ULL));
37*181254a7Smrg return x;
38*181254a7Smrg }
39