bugfix?
This commit is contained in:
parent
63762e6900
commit
2698a8fb30
|
@ -131,6 +131,8 @@ public class DbcField {
|
|||
|
||||
public boolean coversByte(int byteIndex) {
|
||||
int startBit = byteIndex * 8;
|
||||
if (isBigEndian && /* byte endianess less important for one byte fields */ length > 8)
|
||||
startBit += 8;
|
||||
if (startOffset > startBit)
|
||||
return false;
|
||||
return startOffset + length >= startBit + 8;
|
||||
|
|
|
@ -9,9 +9,9 @@ public class DbcFieldTest {
|
|||
@Test
|
||||
public void testBigEndian() {
|
||||
DbcField field = new DbcField("", 8, 16, 1, 0, null, true);
|
||||
assertFalse(field.coversByte(0));
|
||||
assertTrue(field.coversByte(0));
|
||||
assertTrue(field.coversByte(1));
|
||||
assertTrue(field.coversByte(2));
|
||||
assertFalse(field.coversByte(2));
|
||||
assertFalse(field.coversByte(3));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue