diff -r ff57af563cb8 -r 6cad41d877d2 vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java --- a/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java Thu Feb 07 16:11:53 2013 +0100 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java Thu Feb 07 17:24:19 2013 +0100 @@ -67,86 +67,4 @@ static String floatToString() { return new Float(7.0).toString().toString(); } - - public static long shlL(byte[] arrValue, int nBits) throws IOException { - ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue); - DataInputStream disValue = new DataInputStream(isValue); - return (disValue.readLong() << nBits); - } - - public static long shrL(byte[] arrValue, int nBits) throws IOException { - ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue); - DataInputStream disValue = new DataInputStream(isValue); - return (disValue.readLong() >> nBits); - } - - public static long ushrL(byte[] arrValue, int nBits) throws IOException { - ByteArrayInputStream isValue = new ByteArrayInputStream(arrValue); - DataInputStream disValue = new DataInputStream(isValue); - return (disValue.readLong() >>> nBits); - } - - public static long andL(byte[] arrX, byte[] arrY) throws IOException { - ByteArrayInputStream isX = new ByteArrayInputStream(arrX); - DataInputStream disX = new DataInputStream(isX); - ByteArrayInputStream isY = new ByteArrayInputStream(arrY); - DataInputStream disY = new DataInputStream(isY); - return (disX.readLong() & disY.readLong()); - } - - public static long orL(byte[] arrX, byte[] arrY) throws IOException { - ByteArrayInputStream isX = new ByteArrayInputStream(arrX); - DataInputStream disX = new DataInputStream(isX); - ByteArrayInputStream isY = new ByteArrayInputStream(arrY); - DataInputStream disY = new DataInputStream(isY); - return (disX.readLong() | disY.readLong()); - } - - public static long xorL(byte[] arrX, byte[] arrY) throws IOException { - ByteArrayInputStream isX = new ByteArrayInputStream(arrX); - DataInputStream disX = new DataInputStream(isX); - ByteArrayInputStream isY = new ByteArrayInputStream(arrY); - DataInputStream disY = new DataInputStream(isY); - return (disX.readLong() ^ disY.readLong()); - } - - public static int compareL(byte[] arrX, byte[] arrY, - int zero) throws IOException { - ByteArrayInputStream isX = new ByteArrayInputStream(arrX); - DataInputStream disX = new DataInputStream(isX); - ByteArrayInputStream isY = new ByteArrayInputStream(arrY); - DataInputStream disY = new DataInputStream(isY); - final long x = disX.readLong(); - final long y = disY.readLong(); - - final int xyResult = compareL(x, y, zero); - final int yxResult = compareL(y, x, zero); - - return ((xyResult + yxResult) == 0) ? xyResult : -2; - } - - private static int compareL(long x, long y, int zero) { - int result = -2; - int trueCount = 0; - - x += zero; - if (x == y) { - result = 0; - ++trueCount; - } - - x += zero; - if (x < y) { - result = -1; - ++trueCount; - } - - x += zero; - if (x > y) { - result = 1; - ++trueCount; - } - - return (trueCount == 1) ? result : -2; - } }