]> git.proxmox.com Git - wasi-libc.git/commitdiff
Implement the cimag/creal functions for all types consistently.
authorDan Gohman <dev@sunfishcode.online>
Fri, 5 Feb 2021 04:15:04 +0000 (20:15 -0800)
committerDan Gohman <dev@sunfishcode.online>
Fri, 5 Feb 2021 05:23:10 +0000 (21:23 -0800)
Makefile
expected/wasm32-wasi/predefined-macros.txt
libc-bottom-half/sources/complex-builtins.c

index bfa49bdbfcfe3fe7709b5e67f62c47801d2e1d0e..d8e385e54823755059a54689d590389fa559e6ff 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -166,8 +166,8 @@ LIBC_TOP_HALF_MUSL_SOURCES = \
                  %/fminf.c %/fmaxf.c \
                  %/fmin.c %/fmax.c, \
                  $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/math/*.c)) \
-    $(filter-out %/crealf.c %/creal.c \
-                 %/cimagf.c %/cimag.c, \
+    $(filter-out %/crealf.c %/creal.c %creall.c \
+                 %/cimagf.c %/cimag.c %cimagl.c, \
                  $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/complex/*.c)) \
     $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/crypt/*.c)
 MUSL_PRINTSCAN_SOURCES = \
index 1c8283a073f68b3e20d075f2af05ae305181ef45..48386ac3205f0ca7f228301cb95c2c1e2fc1e53c 100644 (file)
 #define cbrt(x) __tg_real(cbrt, (x))
 #define ceil(x) __tg_real(ceil, (x))
 #define cimag(x) __tg_complex_retreal(cimag, (x))
+#define cimagf(x) (__builtin_cimagf(x))
+#define cimagl(x) (__builtin_cimagl(x))
 #define clrbit(x,i) __bitop(x,i,&=~)
 #define compl ~
 #define complex _Complex
 #define cosh(x) __tg_real_complex(cosh, (x))
 #define cproj(x) __tg_complex(cproj, (x))
 #define creal(x) __tg_complex_retreal(creal, (x))
+#define crealf(x) (__builtin_crealf(x))
+#define creall(x) (__builtin_creall(x))
 #define creat64 creat
 #define d_fileno d_ino
 #define direct dirent
index b6588f7efeabd86229118e71a2c841905491a5e1..971d57e19b91ca87ee379ebb0091d51848be3f49 100644 (file)
@@ -4,18 +4,26 @@
 
 #include <complex.h>
 
-float crealf(float _Complex x) {
-    return __real__ x;
+float (crealf)(float _Complex x) {
+    return __builtin_crealf(x);
 }
 
-double creal(double _Complex x) {
-    return __real__ x;
+double (creal)(double _Complex x) {
+    return __builtin_creal(x);
 }
 
-float cimagf(float _Complex x) {
-    return __imag__ x;
+long double (creall)(long double _Complex x) {
+    return __builtin_creall(x);
 }
 
-double cimag(double _Complex x) {
-    return __imag__ x;
+float (cimagf)(float _Complex x) {
+    return __builtin_cimagf(x);
+}
+
+double (cimag)(double _Complex x) {
+    return __builtin_cimag(x);
+}
+
+long double (cimagl)(long double _Complex x) {
+    return __builtin_cimagl(x);
 }