Commit 69916f46 authored by James Willis's avatar James Willis
Browse files

Fixed bug that may cause an overflow in sort_j[].

parent 7e249423
...@@ -290,7 +290,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( ...@@ -290,7 +290,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
const float first_di = sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift; const float first_di = 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. */ /* Loop through particles in cell j until they are not in range of pi. */
while (temp <= cj->count && first_di > sort_j[temp].d) while (temp < cj->count && first_di > sort_j[temp].d)
temp++; temp++;
max_index_i[first_pi] = temp; max_index_i[first_pi] = temp;
...@@ -302,7 +302,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache( ...@@ -302,7 +302,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; const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift;
while (temp <= cj->count && di > sort_j[temp].d) while (temp < cj->count && di > sort_j[temp].d)
temp++; temp++;
max_index_i[i] = temp; max_index_i[i] = temp;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment