Change-Id: Ic1467ec9cdb6820e306bd92ec3137ed185c72dd8
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/18630
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
*/
protected static void alignRead(BitBuffer input, IDeclaration declaration) {
int mask = (int) declaration.getAlignment() - 1;
+
/*
* The alignment is a power of 2
*/
- int pos = (input.position() + mask) & ~mask;
+ int pos = input.position();
+ if ((pos & mask) == 0) {
+ return;
+ }
+ pos = (pos + mask) & ~mask;
+
input.position(pos);
}