diff --git a/src/runner_doiact_vec.c b/src/runner_doiact_vec.c index 5aef9833226e3871adc0edd72220954b88d034be..fb338b50c34e4f23257b3230fbfcafc2ba032960 100644 --- a/src/runner_doiact_vec.c +++ b/src/runner_doiact_vec.c @@ -289,7 +289,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift; /* Loop through particles in cell j until they are not in range of pi. */ - while (temp < cj->count && first_di > sort_j[temp].d) temp++; + while (temp < cj->count - 1 && first_di > sort_j[temp].d) temp++; max_index_i[first_pi] = temp; @@ -300,7 +300,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift; - while (temp < cj->count && di > sort_j[temp].d) temp++; + while (temp < cj->count - 1 && di > sort_j[temp].d) temp++; max_index_i[i] = temp; } @@ -1170,7 +1170,7 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci, vector pjx, pjy, pjz; /* Loop over the parts in cj. */ - for (int pjd = 0; pjd < exit_iteration_align; pjd += VEC_SIZE) { + for (int pjd = 0; pjd <= exit_iteration_align; pjd += VEC_SIZE) { /* Get the cache index to the jth particle. */ int cj_cache_idx = pjd;