From 4799b1981b4efbac7facca9e8a33c5011b0cb7f3 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Tue, 27 Dec 2016 15:47:12 +0100
Subject: [PATCH] Also make use of the new data type for time in the space

---
 src/const.h               | 2 +-
 src/hydro/Gadget2/hydro.h | 4 ++--
 src/space.c               | 4 ++--
 src/timeline.h            | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/const.h b/src/const.h
index f0ee631806..4b46ec1cb0 100644
--- a/src/const.h
+++ b/src/const.h
@@ -59,6 +59,6 @@
 #define SOURCETERMS_NONE
 //#define SOURCETERMS_SN_FEEDBACK
 
-#define ICHECK 116650
+#define ICHECK -116650
 
 #endif /* SWIFT_CONST_H */
diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h
index ace32c1904..9c5f51160f 100644
--- a/src/hydro/Gadget2/hydro.h
+++ b/src/hydro/Gadget2/hydro.h
@@ -288,8 +288,8 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
  * @param timeBase The minimal time-step size
  */
 __attribute__((always_inline)) INLINE static void hydro_prepare_force(
-    struct part *restrict p, struct xpart *restrict xp, int ti_current,
-    double timeBase) {
+    struct part *restrict p, struct xpart *restrict xp,
+    integertime_t ti_current, double timeBase) {
 
   const float fac_mu = 1.f; /* Will change with cosmological integration */
 
diff --git a/src/space.c b/src/space.c
index 86611d3816..23e97d998d 100644
--- a/src/space.c
+++ b/src/space.c
@@ -246,7 +246,7 @@ void space_regrid(struct space *s, int verbose) {
 
   const size_t nr_parts = s->nr_parts;
   const ticks tic = getticks();
-  const int ti_current = (s->e != NULL) ? s->e->ti_current : 0;
+  const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
 
   /* Run through the cells and get the current h_max. */
   // tic = getticks();
@@ -480,7 +480,7 @@ void space_rebuild(struct space *s, int verbose) {
   size_t nr_parts = s->nr_parts;
   size_t nr_gparts = s->nr_gparts;
   struct cell *restrict cells_top = s->cells_top;
-  const int ti_current = (s->e != NULL) ? s->e->ti_current : 0;
+  const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
 
   /* Run through the particles and get their cell index. Allocates
      an index that is larger than the number of particles to avoid
diff --git a/src/timeline.h b/src/timeline.h
index d9691ef846..88f0c6f48b 100644
--- a/src/timeline.h
+++ b/src/timeline.h
@@ -56,7 +56,7 @@ static INLINE integertime_t get_integer_timestep(timebin_t bin) {
 static INLINE timebin_t get_time_bin(integertime_t time_step) {
 
   /* ((int) log_2(time_step)) - 1 */
-  return 62 - intrinsics_clzll(time_step);
+  return (timebin_t)(62 - intrinsics_clzll(time_step));
 }
 
 /**
-- 
GitLab