| author | |
| committer | |
| log | 813ae89208ae39181ecfbd6b76a0e8fd9a38e97b |
| tree | 5f74b7d66478eecec7395f07b61ed6627ee451d4 |
| parent | aa7dac9739f7ce332c2c3841dd7f3a6d17343e0d |
| signature |
14 files changed, 18 insertions(+), 187 deletions(-)
lib/c/math.zig+18| ... | ... | @@ -32,6 +32,12 @@ comptime { |
| 32 | 32 | @export(&nanf, .{ .name = "nanf", .linkage = common.linkage, .visibility = common.visibility }); |
| 33 | 33 | @export(&nanl, .{ .name = "nanl", .linkage = common.linkage, .visibility = common.visibility }); |
| 34 | 34 | } |
| 35 | ||
| 36 | if (builtin.target.isMuslLibC()) { | |
| 37 | @export(&copysignf, .{ .name = "copysignf", .linkage = common.linkage, .visibility = common.visibility }); | |
| 38 | @export(&copysign, .{ .name = "copysign", .linkage = common.linkage, .visibility = common.visibility }); | |
| 39 | } | |
| 40 | @export(&copysignl, .{ .name = "copysignl", .linkage = common.linkage, .visibility = common.visibility }); | |
| 35 | 41 | } |
| 36 | 42 | |
| 37 | 43 | fn isnan(x: f64) callconv(.c) c_int { |
| ... | ... | @@ -57,3 +63,15 @@ fn nanf(_: [*:0]const c_char) callconv(.c) f32 { |
| 57 | 63 | fn nanl(_: [*:0]const c_char) callconv(.c) c_longdouble { |
| 58 | 64 | return std.math.nan(c_longdouble); |
| 59 | 65 | } |
| 66 | ||
| 67 | fn copysignf(x: f32, y: f32) callconv(.c) f32 { | |
| 68 | return std.math.copysign(x, y); | |
| 69 | } | |
| 70 | ||
| 71 | fn copysign(x: f64, y: f64) callconv(.c) f64 { | |
| 72 | return std.math.copysign(x, y); | |
| 73 | } | |
| 74 | ||
| 75 | fn copysignl(x: c_longdouble, y: c_longdouble) callconv(.c) c_longdouble { | |
| 76 | return std.math.copysign(x, y); | |
| 77 | } |
lib/libc/mingw/math/copysign.c deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | /** | |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. | |
| 3 | * This file is part of the mingw-w64 runtime package. | |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. | |
| 5 | */ | |
| 6 | #include <math.h> | |
| 7 | ||
| 8 | typedef union U | |
| 9 | { | |
| 10 | unsigned int u[2]; | |
| 11 | double d; | |
| 12 | } U; | |
| 13 | ||
| 14 | double copysign(double x, double y) | |
| 15 | { | |
| 16 | U h,j; | |
| 17 | h.d = x; | |
| 18 | j.d = y; | |
| 19 | h.u[1] = (h.u[1] & 0x7fffffff) | (j.u[1] & 0x80000000); | |
| 20 | return h.d; | |
| 21 | } |
lib/libc/mingw/math/copysignf.c deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | /** | |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. | |
| 3 | * This file is part of the mingw-w64 runtime package. | |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. | |
| 5 | */ | |
| 6 | #include <math.h> | |
| 7 | ||
| 8 | typedef union ui_f { | |
| 9 | 	float f; | |
| 10 | 	unsigned int ui; | |
| 11 | } ui_f; | |
| 12 | ||
| 13 | float copysignf(float aX, float aY) | |
| 14 | { | |
| 15 | ui_f x,y; | |
| 16 | x.f=aX; y.f=aY; | |
| 17 | x.ui= (x.ui & 0x7fffffff) | (y.ui & 0x80000000); | |
| 18 | return x.f; | |
| 19 | } |
lib/libc/mingw/math/x86/copysignl.S deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /** | |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. | |
| 3 | * This file is part of the mingw-w64 runtime package. | |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. | |
| 5 | */ | |
| 6 | /* | |
| 7 | * Written by J.T. Conklin <jtc@netbsd.org>. | |
| 8 | * Changes for long double by Ulrich Drepper <drepper@cygnus.com> | |
| 9 | * Public domain. | |
| 10 | */ | |
| 11 | #include <_mingw_mac.h> | |
| 12 | ||
| 13 | 	.file	"copysignl.S" | |
| 14 | 	.text | |
| 15 | #ifdef __x86_64__ | |
| 16 | 	.align 8 | |
| 17 | #else | |
| 18 | 	.align 4 | |
| 19 | #endif | |
| 20 | ||
| 21 | 	.globl __MINGW_USYMBOL(copysignl) | |
| 22 | 	.def	__MINGW_USYMBOL(copysignl);	.scl	2;	.type	32;	.endef | |
| 23 | __MINGW_USYMBOL(copysignl): | |
| 24 | #if defined(_AMD64_) || defined(__x86_64__) | |
| 25 | 	movq	(%rdx), %rax | |
| 26 | 	movq	%rax, (%rcx) | |
| 27 | 	movq	8(%rdx), %rax | |
| 28 | 	movq	8(%r8), %rdx | |
| 29 | 	andq	$0x7fff, %rax | |
| 30 | 	andq	$0x8000, %rdx | |
| 31 | 	orq	%rdx, %rax | |
| 32 | 	movq	%rax, 8(%rcx) | |
| 33 | 	movq	%rcx, %rax | |
| 34 | 	ret | |
| 35 | #elif defined(_X86_) || defined(__i386__) | |
| 36 | 	movl	24(%esp),%edx | |
| 37 | 	movl	12(%esp),%eax | |
| 38 | 	andl	$0x8000,%edx | |
| 39 | 	andl	$0x7fff,%eax | |
| 40 | 	orl	%edx,%eax | |
| 41 | 	movl	%eax,12(%esp) | |
| 42 | 	fldt	4(%esp) | |
| 43 | 	ret | |
| 44 | #endif |
lib/libc/musl/src/math/copysign.c deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #include "libm.h" | |
| 2 | ||
| 3 | double copysign(double x, double y) { | |
| 4 | 	union {double f; uint64_t i;} ux={x}, uy={y}; | |
| 5 | 	ux.i &= -1ULL/2; | |
| 6 | 	ux.i |= uy.i & 1ULL<<63; | |
| 7 | 	return ux.f; | |
| 8 | } |
lib/libc/musl/src/math/copysignf.c deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | #include <stdint.h> | |
| 3 | ||
| 4 | float copysignf(float x, float y) | |
| 5 | { | |
| 6 | 	union {float f; uint32_t i;} ux={x}, uy={y}; | |
| 7 | 	ux.i &= 0x7fffffff; | |
| 8 | 	ux.i |= uy.i & 0x80000000; | |
| 9 | 	return ux.f; | |
| 10 | } |
lib/libc/musl/src/math/copysignl.c deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | #include "libm.h" | |
| 2 | ||
| 3 | #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 | |
| 4 | long double copysignl(long double x, long double y) | |
| 5 | { | |
| 6 | 	return copysign(x, y); | |
| 7 | } | |
| 8 | #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 | |
| 9 | long double copysignl(long double x, long double y) | |
| 10 | { | |
| 11 | 	union ldshape ux = {x}, uy = {y}; | |
| 12 | 	ux.i.se &= 0x7fff; | |
| 13 | 	ux.i.se |= uy.i.se & 0x8000; | |
| 14 | 	return ux.f; | |
| 15 | } | |
| 16 | #endif |
lib/libc/musl/src/math/riscv32/copysign.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double copysign(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysign.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv32/copysignf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float copysignf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysignf.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/copysign.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 64 | |
| 4 | ||
| 5 | double copysign(double x, double y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysign.c" | |
| 14 | ||
| 15 | #endif |
lib/libc/musl/src/math/riscv64/copysignf.c deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | #include <math.h> | |
| 2 | ||
| 3 | #if __riscv_flen >= 32 | |
| 4 | ||
| 5 | float copysignf(float x, float y) | |
| 6 | { | |
| 7 | 	__asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); | |
| 8 | 	return x; | |
| 9 | } | |
| 10 | ||
| 11 | #else | |
| 12 | ||
| 13 | #include "../copysignf.c" | |
| 14 | ||
| 15 | #endif |
src/libs/mingw.zig-1| ... | ... | @@ -957,7 +957,6 @@ const mingw32_x86_src = [_][]const u8{ |
| 957 | 957 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2l.c", |
| 958 | 958 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanhl.c", |
| 959 | 959 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanl.c", |
| 960 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "copysignl.S", | |
| 961 | 960 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl.c", |
| 962 | 961 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl_internal.S", |
| 963 | 962 | "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c", |
src/libs/musl.zig-7| ... | ... | @@ -856,9 +856,6 @@ const src_files = [_][]const u8{ |
| 856 | 856 | "musl/src/math/cbrt.c", |
| 857 | 857 | "musl/src/math/cbrtf.c", |
| 858 | 858 | "musl/src/math/cbrtl.c", |
| 859 | "musl/src/math/copysign.c", | |
| 860 | "musl/src/math/copysignf.c", | |
| 861 | "musl/src/math/copysignl.c", | |
| 862 | 859 | "musl/src/math/__cos.c", |
| 863 | 860 | "musl/src/math/__cosdf.c", |
| 864 | 861 | "musl/src/math/cosh.c", |
| ... | ... | @@ -1048,14 +1045,10 @@ const src_files = [_][]const u8{ |
| 1048 | 1045 | "musl/src/math/rint.c", |
| 1049 | 1046 | "musl/src/math/rintf.c", |
| 1050 | 1047 | "musl/src/math/rintl.c", |
| 1051 | "musl/src/math/riscv32/copysign.c", | |
| 1052 | "musl/src/math/riscv32/copysignf.c", | |
| 1053 | 1048 | "musl/src/math/riscv32/fma.c", |
| 1054 | 1049 | "musl/src/math/riscv32/fmaf.c", |
| 1055 | 1050 | "musl/src/math/riscv32/sqrt.c", |
| 1056 | 1051 | "musl/src/math/riscv32/sqrtf.c", |
| 1057 | "musl/src/math/riscv64/copysign.c", | |
| 1058 | "musl/src/math/riscv64/copysignf.c", | |
| 1059 | 1052 | "musl/src/math/riscv64/fma.c", |
| 1060 | 1053 | "musl/src/math/riscv64/fmaf.c", |
| 1061 | 1054 | "musl/src/math/riscv64/sqrt.c", |
src/libs/wasi_libc.zig-1| ... | ... | @@ -710,7 +710,6 @@ const libc_top_half_src_files = [_][]const u8{ |
| 710 | 710 | "musl/src/math/cbrt.c", |
| 711 | 711 | "musl/src/math/cbrtf.c", |
| 712 | 712 | "musl/src/math/cbrtl.c", |
| 713 | "musl/src/math/copysignl.c", | |
| 714 | 713 | "musl/src/math/__cos.c", |
| 715 | 714 | "musl/src/math/__cosdf.c", |
| 716 | 715 | "musl/src/math/coshl.c", |