Direct access to compare64 as well
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 27 Jan 2016 21:24:22 +0100
changeset 1871bcbc4c03d35d
parent 1870 790cc8784820
child 1872 df5db062f180
Direct access to compare64 as well
rt/emul/mini/src/main/resources/org/apidesign/vm4brwsr/emul/lang/java_lang_Number.js
rt/vm/src/main/java/org/apidesign/vm4brwsr/NumberOperations.java
     1.1 --- a/rt/emul/mini/src/main/resources/org/apidesign/vm4brwsr/emul/lang/java_lang_Number.js	Wed Jan 27 21:17:44 2016 +0100
     1.2 +++ b/rt/emul/mini/src/main/resources/org/apidesign/vm4brwsr/emul/lang/java_lang_Number.js	Wed Jan 27 21:24:22 2016 +0100
     1.3 @@ -207,11 +207,11 @@
     1.4          }
     1.5      };
     1.6  
     1.7 -    numberPrototype.compare64 = function(x) {
     1.8 -        if (this.high32() === x.high32()) {
     1.9 -            return (this < x) ? -1 : ((this > x) ? 1 : 0);
    1.10 +    function compare64(x, y) {
    1.11 +        if (x.high32() === y.high32()) {
    1.12 +            return (x < y) ? -1 : ((x > y) ? 1 : 0);
    1.13          }
    1.14 -        return (this.high32() < x.high32()) ? -1 : 1;
    1.15 +        return (x.high32() < y.high32()) ? -1 : 1;
    1.16      };
    1.17  
    1.18      function neg64(x) {
    1.19 @@ -554,7 +554,7 @@
    1.20      b.shl64 = shl64;
    1.21      b.shr64 = shr64;
    1.22      b.ushr64 = ushr64;
    1.23 -    b.compare64 = function(x,y) { return y.compare64(x); };
    1.24 +    b.compare64 = compare64;
    1.25  })(Number.prototype);
    1.26  
    1.27  vm.java_lang_Number(false);
     2.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/NumberOperations.java	Wed Jan 27 21:17:44 2016 +0100
     2.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/NumberOperations.java	Wed Jan 27 21:24:22 2016 +0100
     2.3 @@ -101,7 +101,7 @@
     2.4  
     2.5      public String compare64() {
     2.6          used |= BIT64;
     2.7 -        return "__compare64(@1,@2)";
     2.8 +        return "__compare64(@2,@1)";
     2.9      }
    2.10  
    2.11      public String generate() {