summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2016-02-21 15:15:25 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-21 16:33:39 -0800
commit398cd5d9cc5dde764186d3302125692f27f195c3 (patch)
tree6c17d69ed4a6a51da3549160929e839200d6a121
parent1f7f3c4af59cea6a76a68bdfea95c3ae4f86a615 (diff)
downloadsubsurface-398cd5d9cc5dde764186d3302125692f27f195c3.tar.gz
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 <torvalds@ linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/gaspressures.c12
1 files changed, 1 insertions, 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;