From 398cd5d9cc5dde764186d3302125692f27f195c3 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 21 Feb 2016 15:15:25 -0800 Subject: pressure interpolation: simplify code Getting rid of the pointless always-zero pressure now makes it obvious how some of the remaining code can just be removed too: there is no point in re-initializing the pressure_time entries to zero at the segment start, because they started out zero and we just checked that we don't do anything to them before we hit the segment start. Similarly, now that the silly pressure testing is gone, it is obvious that the code for "i < cur" and "i == curr" cases is identical, and the two cases can just be collapsed. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- subsurface-core/gaspressures.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/subsurface-core/gaspressures.c b/subsurface-core/gaspressures.c index 43c0a11cf..c63e16204 100644 --- a/subsurface-core/gaspressures.c +++ b/subsurface-core/gaspressures.c @@ -191,17 +191,7 @@ static struct pr_interpolate_struct get_pr_interpolate_data(pr_track_t *segment, interpolate.pressure_time += entry->pressure_time; break; } - if (entry->sec == segment->t_start) { - interpolate.acc_pressure_time = 0; - interpolate.pressure_time = 0; - continue; - } - if (i < cur) { - interpolate.acc_pressure_time += entry->pressure_time; - interpolate.pressure_time += entry->pressure_time; - continue; - } - if (i == cur) { + if (i <= cur) { interpolate.acc_pressure_time += entry->pressure_time; interpolate.pressure_time += entry->pressure_time; continue; -- cgit v1.2.3-70-g09d2