Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Khouzam2013-11-20 19:28:44 +0000
committerMatthew Khouzam2013-11-28 15:07:52 +0000
commit8dac44c097d419a6b32c37d2a7599f025ff77f53 (patch)
treea9225568198419d4f1c171183cfe41cc6d2361e1
parentbe2f04f59c6ddbeb7d6fbc5dcd522877d89ead09 (diff)
downloadorg.eclipse.linuxtools-8dac44c097d419a6b32c37d2a7599f025ff77f53.tar.gz
org.eclipse.linuxtools-8dac44c097d419a6b32c37d2a7599f025ff77f53.tar.xz
org.eclipse.linuxtools-8dac44c097d419a6b32c37d2a7599f025ff77f53.zip
ctf: add early exit to alignRead
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>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java
index 17522e31a9..a7e920d943 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java
@@ -138,10 +138,16 @@ public abstract class Definition {
*/
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);
}

Back to the top