Native: compile runtime/src/cpp/math code only for wasm32

This commit is contained in:
Svyatoslav Scherbina
2022-09-02 15:53:34 +02:00
committed by Space
parent 7013fa1864
commit 1b17dbff09
5 changed files with 20 additions and 10 deletions
@@ -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
@@ -1,13 +1,10 @@
#ifdef KONAN_WASM
#include <math.h>
#include <stdint.h>
#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
@@ -1,13 +1,10 @@
#ifdef KONAN_WASM
#include <math.h>
#include <stdint.h>
#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
@@ -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
@@ -1,3 +1,5 @@
#ifdef KONAN_WASM
#include <math.h>
#include <stdint.h>
@@ -29,3 +31,5 @@ double scalbn(double x, int n)
x = y * u.f;
return x;
}
#endif // KONAN_WASM