diff options
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc-0.9.33/powerpc_copysignl.patch')
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-0.9.33/powerpc_copysignl.patch | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-0.9.33/powerpc_copysignl.patch b/meta/recipes-core/uclibc/uclibc-0.9.33/powerpc_copysignl.patch new file mode 100644 index 0000000000..3fa10af4db --- /dev/null +++ b/meta/recipes-core/uclibc/uclibc-0.9.33/powerpc_copysignl.patch | |||
@@ -0,0 +1,113 @@ | |||
1 | Add ppc copysignl implementation | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | |||
5 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
6 | |||
7 | Index: git/libc/sysdeps/linux/powerpc/Makefile.arch | ||
8 | =================================================================== | ||
9 | --- git.orig/libc/sysdeps/linux/powerpc/Makefile.arch | ||
10 | +++ git/libc/sysdeps/linux/powerpc/Makefile.arch | ||
11 | @@ -5,7 +5,7 @@ | ||
12 | # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. | ||
13 | # | ||
14 | |||
15 | -CSRC := __syscall_error.c pread_write.c ioctl.c | ||
16 | +CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c | ||
17 | |||
18 | ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) | ||
19 | CSRC += posix_fadvise.c posix_fadvise64.c | ||
20 | Index: git/libc/sysdeps/linux/powerpc/copysignl.c | ||
21 | =================================================================== | ||
22 | --- /dev/null | ||
23 | +++ git/libc/sysdeps/linux/powerpc/copysignl.c | ||
24 | @@ -0,0 +1,89 @@ | ||
25 | +/* s_copysignl.c -- long double version of s_copysign.c. | ||
26 | + * Conversion to long double by Ulrich Drepper, | ||
27 | + * Cygnus Support, drepper@cygnus.com. | ||
28 | + */ | ||
29 | + | ||
30 | +/* | ||
31 | + * ==================================================== | ||
32 | + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | ||
33 | + * | ||
34 | + * Developed at SunPro, a Sun Microsystems, Inc. business. | ||
35 | + * Permission to use, copy, modify, and distribute this | ||
36 | + * software is freely granted, provided that this notice | ||
37 | + * is preserved. | ||
38 | + * ==================================================== | ||
39 | + */ | ||
40 | + | ||
41 | +/* | ||
42 | + * copysignl(long double x, long double y) | ||
43 | + * copysignl(x,y) returns a value with the magnitude of x and | ||
44 | + * with the sign bit of y. | ||
45 | + */ | ||
46 | + | ||
47 | +#include <endian.h> | ||
48 | +#include <stdint.h> | ||
49 | + | ||
50 | +#if __FLOAT_WORD_ORDER == BIG_ENDIAN | ||
51 | + | ||
52 | +typedef union | ||
53 | +{ | ||
54 | + long double value; | ||
55 | + struct | ||
56 | + { | ||
57 | + int sign_exponent:16; | ||
58 | + unsigned int empty:16; | ||
59 | + uint32_t msw; | ||
60 | + uint32_t lsw; | ||
61 | + } parts; | ||
62 | +} ieee_long_double_shape_type; | ||
63 | + | ||
64 | +#endif | ||
65 | + | ||
66 | +#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN | ||
67 | + | ||
68 | +typedef union | ||
69 | +{ | ||
70 | + long double value; | ||
71 | + struct | ||
72 | + { | ||
73 | + uint32_t lsw; | ||
74 | + uint32_t msw; | ||
75 | + int sign_exponent:16; | ||
76 | + unsigned int empty:16; | ||
77 | + } parts; | ||
78 | +} ieee_long_double_shape_type; | ||
79 | + | ||
80 | +#endif | ||
81 | + | ||
82 | +/* Get int from the exponent of a long double. */ | ||
83 | + | ||
84 | +#define GET_LDOUBLE_EXP(exp,d) \ | ||
85 | +do { \ | ||
86 | + ieee_long_double_shape_type ge_u; \ | ||
87 | + ge_u.value = (d); \ | ||
88 | + (exp) = ge_u.parts.sign_exponent; \ | ||
89 | +} while (0) | ||
90 | + | ||
91 | +/* Set exponent of a long double from an int. */ | ||
92 | + | ||
93 | +#define SET_LDOUBLE_EXP(d,exp) \ | ||
94 | +do { \ | ||
95 | + ieee_long_double_shape_type se_u; \ | ||
96 | + se_u.value = (d); \ | ||
97 | + se_u.parts.sign_exponent = (exp); \ | ||
98 | + (d) = se_u.value; \ | ||
99 | +} while (0) | ||
100 | + | ||
101 | +long double copysignl(long double x, long double y); | ||
102 | +libc_hidden_proto(copysignl); | ||
103 | + | ||
104 | +long double copysignl(long double x, long double y) | ||
105 | +{ | ||
106 | + uint32_t es1,es2; | ||
107 | + GET_LDOUBLE_EXP(es1,x); | ||
108 | + GET_LDOUBLE_EXP(es2,y); | ||
109 | + SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000)); | ||
110 | + return x; | ||
111 | +} | ||
112 | + | ||
113 | +libc_hidden_def(copysignl); | ||