aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSoeren Balko <Soeren.Balko@gmail.com>2014-04-17 14:12:26 +1000
committerSoeren Balko <Soeren.Balko@gmail.com>2014-04-17 14:12:26 +1000
commiteedeeda0ae6558b02f1fa81562af6f6159765f3d (patch)
treeef20cd7618757afea9d2594e8eed186512e4acc0 /src
parent11dfeed10d0fe74d9c47fd0396b87b99f7dde0dc (diff)
asm.js-ify some LLVM intrinsics
Diffstat (limited to 'src')
-rw-r--r--src/library.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index 1d5a9140..a29a9727 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3908,12 +3908,22 @@ LibraryManager.library = {
{{{ makeCopyValues('(ppdest+'+Runtime.QUANTUM_SIZE+')', '(ppsrc+'+Runtime.QUANTUM_SIZE+')', Runtime.QUANTUM_SIZE, 'null', null, 1) }}};
},
+ llvm_bswap_i16__asm: true,
+ llvm_bswap_i16__sig: 'ii',
llvm_bswap_i16: function(x) {
- return ((x&0xff)<<8) | ((x>>8)&0xff);
+ x = x|0;
+ return (((((x&0xff)|0)<<8)|0) |
+ (((x>>8)|0)&0xff)|0)|0;
},
+ llvm_bswap_i32__asm: true,
+ llvm_bswap_i32__sig: 'ii',
llvm_bswap_i32: function(x) {
- return ((x&0xff)<<24) | (((x>>8)&0xff)<<16) | (((x>>16)&0xff)<<8) | (x>>>24);
+ x = x|0;
+ return (((((x&0xff)|0)<<24)|0) |
+ ((((((x>>8)|0)&0xff)|0)<<16)|0) |
+ ((((((x>>16)|0)&0xff)|0)<<8)|0) |
+ ((x>>>24)|0))|0;
},
llvm_bswap_i64__deps: ['llvm_bswap_i32'],