Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/DataAccess.java @ 122:e93101b97e4a
Subtle defect: long & int constant gives wrong results for i2 > 32000+
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 04 Feb 2011 04:05:27 +0100 |
parents | a3a2e5deb320 |
children | d5268ca7715b |
comparison
equal
deleted
inserted
replaced
121:b1d6208fb517 | 122:e93101b97e4a |
---|---|
51 public long readLong() throws IOException { | 51 public long readLong() throws IOException { |
52 byte[] b = new byte[8]; | 52 byte[] b = new byte[8]; |
53 readBytes(b, 0, 8); | 53 readBytes(b, 0, 8); |
54 int i1 = b[0] << 24 | (b[1] & 0xFF) << 16 | (b[2] & 0xFF) << 8 | (b[3] & 0xFF); | 54 int i1 = b[0] << 24 | (b[1] & 0xFF) << 16 | (b[2] & 0xFF) << 8 | (b[3] & 0xFF); |
55 int i2 = b[4] << 24 | (b[5] & 0xFF) << 16 | (b[6] & 0xFF) << 8 | (b[7] & 0xFF); | 55 int i2 = b[4] << 24 | (b[5] & 0xFF) << 16 | (b[6] & 0xFF) << 8 | (b[7] & 0xFF); |
56 return ((long) i1) << 32 | ((long) i2 & 0xFFFFFFFF); | 56 return ((long) i1) << 32 | ((long) i2 & 0xFFFFFFFFl); |
57 } | 57 } |
58 public void readBytes(byte[] buf, int offset, int length) throws IOException { | 58 public void readBytes(byte[] buf, int offset, int length) throws IOException { |
59 throw new UnsupportedOperationException(); | 59 throw new UnsupportedOperationException(); |
60 } | 60 } |
61 public byte readByte() throws IOException { | 61 public byte readByte() throws IOException { |