Martin@438: // empty line needed here Martin@445: Number.prototype.add32 = function(x) { return (this + x) | 0; }; Martin@445: Number.prototype.sub32 = function(x) { return (this - x) | 0; }; Martin@445: Number.prototype.mul32 = function(x) { Martin@445: return (((this * (x >> 16)) << 16) + this * (x & 0xFFFF)) | 0; Martin@438: }; Martin@439: Martin@445: Number.prototype.toInt8 = function() { return (this << 24) >> 24; }; Martin@445: Number.prototype.toInt16 = function() { return (this << 16) >> 16; };