emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_Number.js
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 18 Jan 2013 17:04:16 +0100
branchArrayReflect
changeset 479 34931e381886
parent 440 aa50464da62d
child 582 8e546d108658
permissions -rw-r--r--
Reusing methods from java.lang.reflect.Array when creating new instances of one-dimensional arrays
Martin@438
     1
// empty line needed here
Martin@445
     2
Number.prototype.add32 = function(x) { return (this + x) | 0; };
Martin@445
     3
Number.prototype.sub32 = function(x) { return (this - x) | 0; };
Martin@445
     4
Number.prototype.mul32 = function(x) { 
Martin@445
     5
    return (((this * (x >> 16)) << 16) + this * (x & 0xFFFF)) | 0;
Martin@438
     6
};
Martin@439
     7
Martin@445
     8
Number.prototype.toInt8 = function()  { return (this << 24) >> 24; };
Martin@445
     9
Number.prototype.toInt16 = function() { return (this << 16) >> 16; };