ctf: add early exit to alignRead
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 20 Nov 2013 19:28:44 +0000 (14:28 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 28 Nov 2013 15:07:52 +0000 (10:07 -0500)
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>

org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/Definition.java

index 17522e31a9fb0fffb5191c08708040031930ff0d..a7e920d943de3006ba2d529cca0a4c07b06947a4 100644 (file)
@@ -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);
     }
 
This page took 0.026669 seconds and 5 git commands to generate.