emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_Number.js
brancharithmetic
changeset 445 9e4f01dd6acb
parent 440 aa50464da62d
child 582 8e546d108658
     1.1 --- a/emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_Number.js	Mon Jan 14 09:47:38 2013 +0100
     1.2 +++ b/emul/src/main/resources/org/apidesign/vm4brwsr/emul/java_lang_Number.js	Mon Jan 14 13:21:40 2013 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  // empty line needed here
     1.5 -__add32 = function(x,y) { return (x + y) | 0; };
     1.6 -__sub32 = function(x,y) { return (x - y) | 0; };
     1.7 -__mul32 = function(x,y) { 
     1.8 -    return (((x * (y >> 16)) << 16) + x * (y & 0xFFFF)) | 0;
     1.9 +Number.prototype.add32 = function(x) { return (this + x) | 0; };
    1.10 +Number.prototype.sub32 = function(x) { return (this - x) | 0; };
    1.11 +Number.prototype.mul32 = function(x) { 
    1.12 +    return (((this * (x >> 16)) << 16) + this * (x & 0xFFFF)) | 0;
    1.13  };
    1.14  
    1.15 -__toInt8 = function(x)  { return (x << 24) >> 24; };
    1.16 -__toInt16 = function(x) { return (x << 16) >> 16; };
    1.17 \ No newline at end of file
    1.18 +Number.prototype.toInt8 = function()  { return (this << 24) >> 24; };
    1.19 +Number.prototype.toInt16 = function() { return (this << 16) >> 16; };
    1.20 \ No newline at end of file