ss: Replace hard-coded sizes by their types' sizes
authorLoïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Mon, 1 Aug 2016 14:28:22 +0000 (10:28 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 2 Aug 2016 00:34:14 +0000 (20:34 -0400)
Change-Id: Iefbafd41654a2dbead75333cbd34bf45022a405d
Signed-off-by: Loïc Prieur-Drevon <loic.prieurdrevon@gmail.com>
Reviewed-on: https://git.eclipse.org/r/78267
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/CoreNode.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/historytree/HTNode.java

index 645b37742063cc1e57a41b2bd917b92caaf0ebb6..480c0d925f2f1c8f8eaaf8af72470804adfce445 100644 (file)
@@ -26,12 +26,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
  */
 public final class CoreNode extends HTNode {
 
-    /** Number of bytes in a int */
-    private static final int SIZE_INT = 4;
-
-    /** Number of bytes in a long */
-    private static final int SIZE_LONG = 8;
-
     /** Nb. of children this node has */
     private int nbChildren;
 
@@ -236,14 +230,14 @@ public final class CoreNode extends HTNode {
     protected int getSpecificHeaderSize() {
         int maxChildren = getConfig().getMaxChildren();
         int specificSize =
-                  SIZE_INT /* 1x int (extension node) */
-                + SIZE_INT /* 1x int (nbChildren) */
+                  Integer.BYTES /* 1x int (extension node) */
+                + Integer.BYTES /* 1x int (nbChildren) */
 
                 /* MAX_NB * int ('children' table) */
-                + SIZE_INT * maxChildren
+                + Integer.BYTES * maxChildren
 
                 /* MAX_NB * Timevalue ('childStart' table) */
-                + SIZE_LONG * maxChildren;
+                + Long.BYTES * maxChildren;
 
         return specificSize;
     }
index 651120bb7da9e5e3506946ff63d5af08b316ff74..9cb7b7457239d3d318782b29c65ebd6e82efb838 100644 (file)
@@ -104,7 +104,10 @@ public abstract class HTNode {
      *  1 - byte (done or not)
      * </pre>
      */
-    private static final int COMMON_HEADER_SIZE = 34;
+    private static final int COMMON_HEADER_SIZE = Byte.BYTES
+            + 2 * Long.BYTES
+            + 4 * Integer.BYTES
+            + Byte.BYTES;
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -445,7 +448,7 @@ public abstract class HTNode {
                  * null anyway).
                  */
                 ITmfStateInterval interval = fIntervals.get(i);
-                if (interval.getStartTime() <= t &&
+                if (t >= interval.getStartTime() &&
                         interval.getAttribute() < stateInfo.size()) {
                     stateInfo.set(interval.getAttribute(), interval);
                 }
This page took 0.025965 seconds and 5 git commands to generate.