Implementation of Variable length BinaryStruct fields, one TC is failing
This commit is contained in:
parent
e41fe70951
commit
dd1b55106b
8 changed files with 139 additions and 21 deletions
|
|
@ -73,13 +73,13 @@ public class ByteUtil {
|
|||
* Returns a byte bitmask
|
||||
*
|
||||
* @param index start index of the mask, valid values 0-7
|
||||
* @param length length of mask from index, valid values 1-8
|
||||
* @param length length of mask from index, valid values 1-8 depending on index
|
||||
*/
|
||||
public static byte getBitMask(int index, int length) {
|
||||
--length;
|
||||
if(0 > index || index > 7)
|
||||
throw new IllegalArgumentException("Invalid index argument, allowed value is 0-7");
|
||||
if(length < 0 && index-length < 0)
|
||||
if(length < 0 || 7-index-length < 0)
|
||||
throw new IllegalArgumentException("Invalid length argument: "+length+", allowed values 1-8 depending on index");
|
||||
return (byte) BYTE_MASK[index][length];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue