vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java
brancharithmetic
changeset 617 960e219425e2
parent 616 9cbf1f2ad7ee
child 620 189f695d0b02
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java	Thu Jan 31 13:42:14 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/Numbers.java	Thu Jan 31 13:55:12 2013 +0100
     1.3 @@ -95,4 +95,16 @@
     1.4      public static long modL(long x, long y) {
     1.5          return (x % y);
     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  }