Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
1783cab7
Commit
1783cab7
authored
Mar 09, 2016
by
Pedro Gonnet
Browse files
use ptrdiff_t instead of size_t where appropriate.
parent
d45fd673
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/space.c
View file @
1783cab7
...
...
@@ -570,8 +570,8 @@ void space_do_parts_sort() {
if
(
!
space_sort_struct
.
waiting
)
return
;
/* Get the stack entry. */
in
t
i
=
space_sort_struct
.
stack
[
qid
].
i
;
in
t
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. */
in
t
ii
=
i
;
in
t
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
)
{
in
t
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
;
...
...
src/space.h
View file @
1783cab7
...
...
@@ -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
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment