author | Martin Soch <Martin.Soch@oracle.com> |
Mon, 14 Jan 2013 13:21:40 +0100 | |
branch | arithmetic |
changeset 445 | 9e4f01dd6acb |
parent 440 | aa50464da62d |
child 582 | 8e546d108658 |
permissions | -rw-r--r-- |
1 // empty line needed here
2 Number.prototype.add32 = function(x) { return (this + x) | 0; };
3 Number.prototype.sub32 = function(x) { return (this - x) | 0; };
4 Number.prototype.mul32 = function(x) {
5 return (((this * (x >> 16)) << 16) + this * (x & 0xFFFF)) | 0;
6 };
8 Number.prototype.toInt8 = function() { return (this << 24) >> 24; };
9 Number.prototype.toInt16 = function() { return (this << 16) >> 16; };