Skip to content

Commit d277bb7

Browse files
committed
Implement some missing maths-related intrinsics
1 parent b0982ef commit d277bb7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/library.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,10 +1398,16 @@ LibraryManager.library = {
13981398
llvm_sqrt_f64: 'Math_sqrt',
13991399
llvm_pow_f32: 'Math_pow',
14001400
llvm_pow_f64: 'Math_pow',
1401+
llvm_powi_f32: 'Math_pow',
1402+
llvm_powi_f64: 'Math_pow',
14011403
llvm_log_f32: 'Math_log',
14021404
llvm_log_f64: 'Math_log',
14031405
llvm_exp_f32: 'Math_exp',
14041406
llvm_exp_f64: 'Math_exp',
1407+
llvm_trunc_f32: 'Math_trunc',
1408+
llvm_trunc_f64: 'Math_trunc',
1409+
llvm_floor_f32: 'Math_floor',
1410+
llvm_floor_f64: 'Math_floor',
14051411

14061412
round__asm: true,
14071413
round__sig: 'dd',

src/preamble.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,11 @@ if (!Math['clz32']) Math['clz32'] = function(x) {
17461746
};
17471747
Math.clz32 = Math['clz32']
17481748

1749+
if (!Math['trunc']) Math['trunc'] = function(x) {
1750+
return x < 0 ? Math.ceil(x) : Math.floor(x);
1751+
};
1752+
Math.trunc = Math['trunc'];
1753+
17491754
var Math_abs = Math.abs;
17501755
var Math_cos = Math.cos;
17511756
var Math_sin = Math.sin;
@@ -1764,6 +1769,7 @@ var Math_imul = Math.imul;
17641769
var Math_fround = Math.fround;
17651770
var Math_min = Math.min;
17661771
var Math_clz32 = Math.clz32;
1772+
var Math_trunc = Math.trunc;
17671773

17681774
// A counter of dependencies for calling run(). If we need to
17691775
// do asynchronous work before running, increment this and

0 commit comments

Comments
 (0)