Commit 129f3a2d authored by Sebastian Vollbrecht's avatar Sebastian Vollbrecht

Fixed a bug which resulted in the computation of negative inner delays.

parent 20a1dd9e
...@@ -436,7 +436,7 @@ public class SchedulingUtils { ...@@ -436,7 +436,7 @@ public class SchedulingUtils {
} else if (backedgeDistance <= 0) { } else if (backedgeDistance <= 0) {
throw new IllegalArgumentException("Backedge distance must be positive."); throw new IllegalArgumentException("Backedge distance must be positive.");
} }
return backedgeDistance * (minII - 1) - backedgeDelay + 1; return Math.max(0, backedgeDistance * (minII - 1) - backedgeDelay + 1);
} }
/** /**
......
...@@ -887,6 +887,16 @@ public class SchedulingUtilsTest { ...@@ -887,6 +887,16 @@ public class SchedulingUtilsTest {
assertEquals(236, minInnerDelay); assertEquals(236, minInnerDelay);
assertEquals(240, maxInnerDelay); assertEquals(240, maxInnerDelay);
minII = 2;
backedgeDelay = 4;
backedgeDistance = 2;
minInnerDelay = SchedulingUtils.getMinInnerDelay(minII, backedgeDelay, backedgeDistance);
maxInnerDelay = SchedulingUtils.getMaxInnerDelay(minII, backedgeDelay, backedgeDistance);
// Verify that the minimum delay is not negative.
assertEquals(0, minInnerDelay);
assertEquals(0, maxInnerDelay);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment