From 1b17dbff090611cd8e8dd290b26eac20f1b86770 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 2 Sep 2022 15:53:34 +0200 Subject: [PATCH] Native: compile runtime/src/cpp/math code only for wasm32 --- kotlin-native/runtime/src/main/cpp/math/endian.h | 4 ++++ kotlin-native/runtime/src/main/cpp/math/fmod.cpp | 9 ++++----- kotlin-native/runtime/src/main/cpp/math/fmodf.cpp | 9 ++++----- kotlin-native/runtime/src/main/cpp/math/libm.h | 4 ++++ kotlin-native/runtime/src/main/cpp/math/scalbn.cpp | 4 ++++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/kotlin-native/runtime/src/main/cpp/math/endian.h b/kotlin-native/runtime/src/main/cpp/math/endian.h index 1bd444518ab..29b91dfb22a 100644 --- a/kotlin-native/runtime/src/main/cpp/math/endian.h +++ b/kotlin-native/runtime/src/main/cpp/math/endian.h @@ -1,3 +1,5 @@ +#ifdef KONAN_WASM + #ifndef _ENDIAN_H #define _ENDIAN_H @@ -80,3 +82,5 @@ static __inline uint64_t __bswap64(uint64_t __x) #endif #endif + +#endif // KONAN_WASM \ No newline at end of file diff --git a/kotlin-native/runtime/src/main/cpp/math/fmod.cpp b/kotlin-native/runtime/src/main/cpp/math/fmod.cpp index 2579b7d36ce..263f3b2ef59 100644 --- a/kotlin-native/runtime/src/main/cpp/math/fmod.cpp +++ b/kotlin-native/runtime/src/main/cpp/math/fmod.cpp @@ -1,13 +1,10 @@ +#ifdef KONAN_WASM + #include #include - -#ifdef KONAN_WASM #include "Common.h" -#endif -#ifdef KONAN_WASM RUNTIME_USED -#endif double fmod(double x, double y) { union {double f; uint64_t i;} ux = {x}, uy = {y}; @@ -73,3 +70,5 @@ double fmod(double x, double y) ux.i = uxi; return ux.f; } + +#endif // KONAN_WASM diff --git a/kotlin-native/runtime/src/main/cpp/math/fmodf.cpp b/kotlin-native/runtime/src/main/cpp/math/fmodf.cpp index cde03453e05..7619ea83757 100644 --- a/kotlin-native/runtime/src/main/cpp/math/fmodf.cpp +++ b/kotlin-native/runtime/src/main/cpp/math/fmodf.cpp @@ -1,13 +1,10 @@ +#ifdef KONAN_WASM + #include #include - -#ifdef KONAN_WASM #include "Common.h" -#endif -#ifdef KONAN_WASM RUNTIME_USED -#endif float fmodf(float x, float y) { union {float f; uint32_t i;} ux = {x}, uy = {y}; @@ -70,3 +67,5 @@ float fmodf(float x, float y) ux.i = uxi; return ux.f; } + +#endif // KONAN_WASM diff --git a/kotlin-native/runtime/src/main/cpp/math/libm.h b/kotlin-native/runtime/src/main/cpp/math/libm.h index bef69d8cf52..bff6cc88bd6 100644 --- a/kotlin-native/runtime/src/main/cpp/math/libm.h +++ b/kotlin-native/runtime/src/main/cpp/math/libm.h @@ -1,3 +1,5 @@ +#ifdef KONAN_WASM + /* origin: FreeBSD /usr/src/lib/msun/src/math_private.h */ /* * ==================================================== @@ -161,3 +163,5 @@ long double __polevll(long double, const long double *, int); long double __p1evll(long double, const long double *, int); #endif + +#endif // KONAN_WASM diff --git a/kotlin-native/runtime/src/main/cpp/math/scalbn.cpp b/kotlin-native/runtime/src/main/cpp/math/scalbn.cpp index 530e07c79f0..57b5d0eea89 100644 --- a/kotlin-native/runtime/src/main/cpp/math/scalbn.cpp +++ b/kotlin-native/runtime/src/main/cpp/math/scalbn.cpp @@ -1,3 +1,5 @@ +#ifdef KONAN_WASM + #include #include @@ -29,3 +31,5 @@ double scalbn(double x, int n) x = y * u.f; return x; } + +#endif // KONAN_WASM