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