Skip to content

Instantly share code, notes, and snippets.

@zbinlin
Created December 2, 2014 13:47
Show Gist options
  • Save zbinlin/1b51fcebf4f392f1dbfe to your computer and use it in GitHub Desktop.
Save zbinlin/1b51fcebf4f392f1dbfe to your computer and use it in GitHub Desktop.
var Uint32 = {
"~": function (a) {
return ~a >>> 0;
},
not: function (a) {
return this["~"](a);
},
"&": function (a, b) {
return (a & b) >>> 0;
},
and: function (a, b) {
return this["&"](a, b);
},
"|": function (a, b) {
return (a | b) >>> 0;
}
or: function (a, b) {
return this["|"](a, b);
},
"^": function (a, b) {
return (a ^ b) >>> 0;
},
xor: function (a, b) {
return this["^"](a, b);
},
"<<<": function (a, b) {
return (a << b) >>> 0;
},
lShift: function (a, b) {
return this["<<<"](a, b);
},
">>>": function (a, b) {
return a >>> b;
},
rShfit: function (a, b) {
return this[">>>"](a, b);
},
_sign: function (a) {
return 0 > a ? -1 : 1;
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment