Commit 1783cab7 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

use ptrdiff_t instead of size_t where appropriate.

parent d45fd673
......@@ -570,8 +570,8 @@ void space_do_parts_sort() {
if (!space_sort_struct.waiting) return;
/* Get the stack entry. */
int i = space_sort_struct.stack[qid].i;
int j = space_sort_struct.stack[qid].j;
ptrdiff_t i = space_sort_struct.stack[qid].i;
ptrdiff_t j = space_sort_struct.stack[qid].j;
int min = space_sort_struct.stack[qid].min;
int max = space_sort_struct.stack[qid].max;
space_sort_struct.stack[qid].ready = 0;
......@@ -585,13 +585,13 @@ void space_do_parts_sort() {
i, j, min, max, pivot); */
/* One pass of QuickSort's partitioning. */
int ii = i;
int jj = j;
ptrdiff_t ii = i;
ptrdiff_t jj = j;
while (ii < jj) {
while (ii <= j && ind[ii] <= pivot) ii++;
while (jj >= i && ind[jj] > pivot) jj--;
if (ii < jj) {
int temp_i = ind[ii];
size_t temp_i = ind[ii];
ind[ii] = ind[jj];
ind[jj] = temp_i;
struct part temp_p = parts[ii];
......@@ -689,7 +689,7 @@ void space_gparts_sort(struct gpart *gparts, size_t *ind, size_t N, int min,
volatile unsigned int first, last, waiting;
int pivot;
size_t i, ii, j, jj, temp_i;
ptrdiff_t i, ii, j, jj, temp_i;
int qid;
struct gpart temp_p;
......
......@@ -20,6 +20,9 @@
#define SWIFT_SPACE_H
/* Includes. */
#include <stddef.h>
/* Local includes. */
#include "cell.h"
#include "part.h"
......@@ -107,7 +110,7 @@ struct space {
/* Interval stack necessary for parallel particle sorting. */
struct qstack {
volatile size_t i, j;
volatile ptrdiff_t i, j;
volatile int min, max;
volatile int ready;
};
......
Markdown is supported
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