Forked from kripken/gist:406fa34ab78a608a3442aaa8b0e77a40
Created
November 12, 2017 17:18
-
-
Save AlexxNica/b1e674c91b7b186b39748106885246ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeAtomicOps(ofType) { | |
function makeRMW(opName) { | |
return function(bytes, offset, ptr, value) { | |
return Module['_BinaryenAtomicRMW'](module, Module[opName], bytes, offset, ptr, value, ofType); | |
}; | |
} | |
return { | |
'rmw': { | |
'add': makeRMW('AtomicRMWAdd'), | |
'sub': makeRMW('AtomicRMWSub'), | |
'and': makeRMW('AtomicRMWAnd'), | |
'or': makeRMW('AtomicRMWOr'), | |
'xor': makeRMW('AtomicRMWXor'), | |
'xchg': makeRMW('AtomicRMWXchg'), | |
'cmpxchg': function(bytes, offset, ptr, expected, replacement) { | |
return Module['_BinaryenAtomicCmpxchg'](module, bytes, offset, ptr, expected, replacement, ofType) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment