aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeff Terrace <jterrace@gmail.com>2011-10-14 18:16:51 -0400
committerJeff Terrace <jterrace@gmail.com>2011-10-14 18:16:51 -0400
commite033f3b372fb103f3f962c3c8c0ce7b17a8336fb (patch)
tree5733d06e861ef854a3e16387b5725a6a34a317ae /src
parent6e2379b7c86236ed4c7059e6a8a979fa9d4df7d6 (diff)
Added llvm_ctlz_i32
Diffstat (limited to 'src')
-rw-r--r--src/library.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index c753422d..3e9168c5 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4003,6 +4003,15 @@ LibraryManager.library = {
}
return ret;
},
+
+ llvm_ctlz_i32: function(x) {
+ for (var i=0; i<32; i++) {
+ if ( (x & (1 << (31-i))) != 0 ) {
+ return i;
+ }
+ }
+ return 32;
+ },
__assert_fail: function(condition, file, line) {
ABORT = true;