aboutsummaryrefslogtreecommitdiff
path: root/src/lj_vmmath.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_vmmath.c')
-rw-r--r--src/lj_vmmath.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lj_vmmath.c b/src/lj_vmmath.c
index b60858b2..6ea99d15 100644
--- a/src/lj_vmmath.c
+++ b/src/lj_vmmath.c
@@ -17,14 +17,25 @@
17 17
18#if LJ_TARGET_X86 && __ELF__ && __PIC__ 18#if LJ_TARGET_X86 && __ELF__ && __PIC__
19/* Wrapper functions to deal with the ELF/x86 PIC disaster. */ 19/* Wrapper functions to deal with the ELF/x86 PIC disaster. */
20LJ_FUNCA double lj_wrap_log(double x) { return log(x); }
21LJ_FUNCA double lj_wrap_log10(double x) { return log10(x); }
22LJ_FUNCA double lj_wrap_exp(double x) { return exp(x); }
23LJ_FUNCA double lj_wrap_sin(double x) { return sin(x); }
24LJ_FUNCA double lj_wrap_cos(double x) { return cos(x); }
25LJ_FUNCA double lj_wrap_tan(double x) { return tan(x); }
26LJ_FUNCA double lj_wrap_asin(double x) { return asin(x); }
27LJ_FUNCA double lj_wrap_acos(double x) { return acos(x); }
28LJ_FUNCA double lj_wrap_atan(double x) { return atan(x); }
20LJ_FUNCA double lj_wrap_sinh(double x) { return sinh(x); } 29LJ_FUNCA double lj_wrap_sinh(double x) { return sinh(x); }
21LJ_FUNCA double lj_wrap_cosh(double x) { return cosh(x); } 30LJ_FUNCA double lj_wrap_cosh(double x) { return cosh(x); }
22LJ_FUNCA double lj_wrap_tanh(double x) { return tanh(x); } 31LJ_FUNCA double lj_wrap_tanh(double x) { return tanh(x); }
32LJ_FUNCA double lj_wrap_atan2(double x, double y) { return atan2(x, y); }
33LJ_FUNCA double lj_wrap_pow(double x, double y) { return pow(x, y); }
34LJ_FUNCA double lj_wrap_fmod(double x, double y) { return fmod(x, y); }
23#endif 35#endif
24 36
25/* -- Helper functions for generated machine code ------------------------- */ 37/* -- Helper functions for generated machine code ------------------------- */
26 38
27#if !LJ_TARGET_X86ORX64
28double lj_vm_foldarith(double x, double y, int op) 39double lj_vm_foldarith(double x, double y, int op)
29{ 40{
30 switch (op) { 41 switch (op) {
@@ -45,7 +56,6 @@ double lj_vm_foldarith(double x, double y, int op)
45 default: return x; 56 default: return x;
46 } 57 }
47} 58}
48#endif
49 59
50#if LJ_HASJIT 60#if LJ_HASJIT
51 61
@@ -109,6 +119,7 @@ double lj_vm_powi(double x, int32_t k)
109 else 119 else
110 return 1.0 / lj_vm_powui(x, (uint32_t)-k); 120 return 1.0 / lj_vm_powui(x, (uint32_t)-k);
111} 121}
122#endif
112 123
113/* Computes fpm(x) for extended math functions. */ 124/* Computes fpm(x) for extended math functions. */
114double lj_vm_foldfpm(double x, int fpm) 125double lj_vm_foldfpm(double x, int fpm)
@@ -130,7 +141,6 @@ double lj_vm_foldfpm(double x, int fpm)
130 } 141 }
131 return 0; 142 return 0;
132} 143}
133#endif
134 144
135#if LJ_HASFFI 145#if LJ_HASFFI
136int lj_vm_errno(void) 146int lj_vm_errno(void)