jdk/src/java.base/share/classes/java/nio/Bits.java
changeset 32649 2ee9017c7597
parent 30338 957ee8b5a33a
child 32834 e1dca5fe4de3
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
    62     }
    62     }
    63 
    63 
    64 
    64 
    65     // -- get/put char --
    65     // -- get/put char --
    66 
    66 
    67     static private char makeChar(byte b1, byte b0) {
    67     private static char makeChar(byte b1, byte b0) {
    68         return (char)((b1 << 8) | (b0 & 0xff));
    68         return (char)((b1 << 8) | (b0 & 0xff));
    69     }
    69     }
    70 
    70 
    71     static char getCharL(ByteBuffer bb, int bi) {
    71     static char getCharL(ByteBuffer bb, int bi) {
    72         return makeChar(bb._get(bi + 1),
    72         return makeChar(bb._get(bi + 1),
   134     }
   134     }
   135 
   135 
   136 
   136 
   137     // -- get/put short --
   137     // -- get/put short --
   138 
   138 
   139     static private short makeShort(byte b1, byte b0) {
   139     private static short makeShort(byte b1, byte b0) {
   140         return (short)((b1 << 8) | (b0 & 0xff));
   140         return (short)((b1 << 8) | (b0 & 0xff));
   141     }
   141     }
   142 
   142 
   143     static short getShortL(ByteBuffer bb, int bi) {
   143     static short getShortL(ByteBuffer bb, int bi) {
   144         return makeShort(bb._get(bi + 1),
   144         return makeShort(bb._get(bi + 1),
   206     }
   206     }
   207 
   207 
   208 
   208 
   209     // -- get/put int --
   209     // -- get/put int --
   210 
   210 
   211     static private int makeInt(byte b3, byte b2, byte b1, byte b0) {
   211     private static int makeInt(byte b3, byte b2, byte b1, byte b0) {
   212         return (((b3       ) << 24) |
   212         return (((b3       ) << 24) |
   213                 ((b2 & 0xff) << 16) |
   213                 ((b2 & 0xff) << 16) |
   214                 ((b1 & 0xff) <<  8) |
   214                 ((b1 & 0xff) <<  8) |
   215                 ((b0 & 0xff)      ));
   215                 ((b0 & 0xff)      ));
   216     }
   216     }
   299     }
   299     }
   300 
   300 
   301 
   301 
   302     // -- get/put long --
   302     // -- get/put long --
   303 
   303 
   304     static private long makeLong(byte b7, byte b6, byte b5, byte b4,
   304     private static long makeLong(byte b7, byte b6, byte b5, byte b4,
   305                                  byte b3, byte b2, byte b1, byte b0)
   305                                  byte b3, byte b2, byte b1, byte b0)
   306     {
   306     {
   307         return ((((long)b7       ) << 56) |
   307         return ((((long)b7       ) << 56) |
   308                 (((long)b6 & 0xff) << 48) |
   308                 (((long)b6 & 0xff) << 48) |
   309                 (((long)b5 & 0xff) << 40) |
   309                 (((long)b5 & 0xff) << 40) |