vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java
brancharithmetic
changeset 699 6cad41d877d2
parent 698 ff57af563cb8
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java	Thu Feb 07 16:11:53 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java	Thu Feb 07 17:24:19 2013 +0100
     1.3 @@ -67,86 +67,4 @@
     1.4      static String floatToString() {
     1.5          return new Float(7.0).toString().toString();
     1.6      }
     1.7 -    
     1.8 -    public static long shlL(byte[] arrValue, int nBits) throws IOException {
     1.9 -        ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue);
    1.10 -        DataInputStream disValue = new DataInputStream(isValue);
    1.11 -        return (disValue.readLong() << nBits);
    1.12 -    }
    1.13 -    
    1.14 -    public static long shrL(byte[] arrValue, int nBits) throws IOException {
    1.15 -        ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue);
    1.16 -        DataInputStream disValue = new DataInputStream(isValue);
    1.17 -        return (disValue.readLong() >> nBits);
    1.18 -    }
    1.19 -    
    1.20 -    public static long ushrL(byte[] arrValue, int nBits) throws IOException {
    1.21 -        ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue);
    1.22 -        DataInputStream disValue = new DataInputStream(isValue);
    1.23 -        return (disValue.readLong() >>> nBits);
    1.24 -    }
    1.25 -    
    1.26 -    public static long andL(byte[] arrX, byte[] arrY) throws IOException {
    1.27 -        ByteArrayInputStream isX = new ByteArrayInputStream(arrX);
    1.28 -        DataInputStream disX = new DataInputStream(isX);
    1.29 -        ByteArrayInputStream isY = new ByteArrayInputStream(arrY);
    1.30 -        DataInputStream disY = new DataInputStream(isY);
    1.31 -        return (disX.readLong() & disY.readLong());
    1.32 -    }
    1.33 -    
    1.34 -    public static long orL(byte[] arrX, byte[] arrY) throws IOException {
    1.35 -        ByteArrayInputStream isX = new ByteArrayInputStream(arrX);
    1.36 -        DataInputStream disX = new DataInputStream(isX);
    1.37 -        ByteArrayInputStream isY = new ByteArrayInputStream(arrY);
    1.38 -        DataInputStream disY = new DataInputStream(isY);
    1.39 -        return (disX.readLong() | disY.readLong());
    1.40 -    }
    1.41 -    
    1.42 -    public static long xorL(byte[] arrX, byte[] arrY) throws IOException {
    1.43 -        ByteArrayInputStream isX = new ByteArrayInputStream(arrX);
    1.44 -        DataInputStream disX = new DataInputStream(isX);
    1.45 -        ByteArrayInputStream isY = new ByteArrayInputStream(arrY);
    1.46 -        DataInputStream disY = new DataInputStream(isY);
    1.47 -        return (disX.readLong() ^ disY.readLong());
    1.48 -    }
    1.49 -
    1.50 -    public static int compareL(byte[] arrX, byte[] arrY,
    1.51 -                               int zero) throws IOException {
    1.52 -        ByteArrayInputStream isX = new ByteArrayInputStream(arrX);
    1.53 -        DataInputStream disX = new DataInputStream(isX);
    1.54 -        ByteArrayInputStream isY = new ByteArrayInputStream(arrY);
    1.55 -        DataInputStream disY = new DataInputStream(isY);
    1.56 -        final long x = disX.readLong();
    1.57 -        final long y = disY.readLong();
    1.58 -
    1.59 -        final int xyResult = compareL(x, y, zero);
    1.60 -        final int yxResult = compareL(y, x, zero);
    1.61 -
    1.62 -        return ((xyResult + yxResult) == 0) ? xyResult : -2;
    1.63 -    }
    1.64 -
    1.65 -    private static int compareL(long x, long y, int zero) {
    1.66 -        int result = -2;
    1.67 -        int trueCount = 0;
    1.68 -
    1.69 -        x += zero;
    1.70 -        if (x == y) {
    1.71 -            result = 0;
    1.72 -            ++trueCount;
    1.73 -        }
    1.74 -
    1.75 -        x += zero;
    1.76 -        if (x < y) {
    1.77 -            result = -1;
    1.78 -            ++trueCount;
    1.79 -        }
    1.80 -
    1.81 -        x += zero;
    1.82 -        if (x > y) {
    1.83 -            result = 1;
    1.84 -            ++trueCount;
    1.85 -        }
    1.86 -
    1.87 -        return (trueCount == 1) ? result : -2;
    1.88 -    }
    1.89  }