From aff91cb461edc2ba07678129e08fd41dd09e73de Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Thu, 17 Mar 2022 09:36:21 +0100 Subject: [PATCH] Avoid casting timesteps to 32bit in C++ standalone Before, long runs with more than 2e9 timesteps failed to run. Fixes #1394 --- .../devices/cpp_standalone/brianlib/clocks.h | 10 +++++----- brian2/tests/test_network.py | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/brian2/devices/cpp_standalone/brianlib/clocks.h b/brian2/devices/cpp_standalone/brianlib/clocks.h index b33168304..d559bfb35 100644 --- a/brian2/devices/cpp_standalone/brianlib/clocks.h +++ b/brian2/devices/cpp_standalone/brianlib/clocks.h @@ -6,9 +6,9 @@ #include namespace { - inline int fround(double x) + inline int64_t fround(double x) { - return (int)(x+0.5); + return (int64_t)(x+0.5); }; }; @@ -28,20 +28,20 @@ class Clock inline bool running() { return timestep[0]