From 44f8a0df61f7b4d5eb723dff528ee792d3af4010 Mon Sep 17 00:00:00 2001
From: James Willis <james.s.willis@durham.ac.uk>
Date: Wed, 26 Jul 2017 17:06:27 +0100
Subject: [PATCH] Changed type of max_d from float to int.

---
 src/cache.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/cache.h b/src/cache.h
index 3313cb4186..26d9a65a5a 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -114,6 +114,7 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
   unsigned int pad = 2 * VEC_SIZE, rem = count % VEC_SIZE;
   if (rem > 0) pad += VEC_SIZE - rem;
   unsigned int sizeBytes = (count + pad) * sizeof(float);
+  unsigned int sizeIntBytes = (count + pad) * sizeof(int);
   int error = 0;
 
   /* Free memory if cache has already been allocated. */
@@ -137,7 +138,7 @@ __attribute__((always_inline)) INLINE void cache_init(struct cache *c,
   error += posix_memalign((void **)&c->vy, CACHE_ALIGN, sizeBytes);
   error += posix_memalign((void **)&c->vz, CACHE_ALIGN, sizeBytes);
   error += posix_memalign((void **)&c->h, CACHE_ALIGN, sizeBytes);
-  error += posix_memalign((void **)&c->max_d, CACHE_ALIGN, sizeBytes);
+  error += posix_memalign((void **)&c->max_d, CACHE_ALIGN, sizeIntBytes);
 
   if (error != 0)
     error("Couldn't allocate cache, no. of particles: %d", (int)count);
-- 
GitLab