From a059e514a8e74a8d2f3ee8d910f2534adf59b4f8 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 6 Sep 2023 16:10:08 -0400 Subject: [PATCH] OutputFieldsDefault: fix next_out edge case floordiv would also work --- src/include/OutputFieldsDefault.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/include/OutputFieldsDefault.h b/src/include/OutputFieldsDefault.h index 9f49004b6..0d76bd537 100644 --- a/src/include/OutputFieldsDefault.h +++ b/src/include/OutputFieldsDefault.h @@ -83,6 +83,8 @@ struct BaseOutputFieldItemParams // Returns the next output timestep after the given timestep. int next_out(int timestep) { + if (timestep < out_first) + return out_first; int n_intervals_elapsed = (timestep - out_first) / out_interval; return out_first + out_interval * (n_intervals_elapsed + 1); }