aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-07 18:16:04 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-07 18:16:04 -0800
commitf7e59e31bf9652293c9c96e90866e73236a2ae51 (patch)
tree42f9fd9fc652a6221feb523f008a7b584b0ebef1 /src/library.js
parent97ffe5025c4cebcfcf84795635d466fd748236be (diff)
support llvm_ctpop_*; fixes #918
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 6ba6dab3..d787e30c 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4896,6 +4896,20 @@ LibraryManager.library = {
#endif
},
+ llvm_ctpop_i32: function(x) {
+ var ret = 0;
+ while (x) {
+ if (x&1) ret++;
+ x >>= 1;
+ }
+ return ret;
+ },
+
+ llvm_ctpop_i64__deps: ['llvm_ctpop_i32'],
+ llvm_ctpop_i64: function(l, h) {
+ return _llvm_ctpop_i32(l) + _llvm_ctpop_i32(h);
+ },
+
llvm_trap: function() {
throw 'trap! ' + new Error().stack;
},