Skip to content
GitLab
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
6f60bbf9
Commit
6f60bbf9
authored
Nov 09, 2016
by
Pedro Gonnet
Browse files
use memswap in the sorting routines.
parent
fd51df93
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/space.c
View file @
6f60bbf9
...
...
@@ -49,6 +49,7 @@
#include
"hydro.h"
#include
"kernel_hydro.h"
#include
"lock.h"
#include
"memswap.h"
#include
"minmax.h"
#include
"runner.h"
#include
"threadpool.h"
...
...
@@ -1043,15 +1044,9 @@ void space_parts_sort_mapper(void *map_data, int num_elements,
while
(
ii
<=
j
&&
ind
[
ii
]
<=
pivot
)
ii
++
;
while
(
jj
>=
i
&&
ind
[
jj
]
>
pivot
)
jj
--
;
if
(
ii
<
jj
)
{
size_t
temp_i
=
ind
[
ii
];
ind
[
ii
]
=
ind
[
jj
];
ind
[
jj
]
=
temp_i
;
struct
part
temp_p
=
parts
[
ii
];
parts
[
ii
]
=
parts
[
jj
];
parts
[
jj
]
=
temp_p
;
struct
xpart
temp_xp
=
xparts
[
ii
];
xparts
[
ii
]
=
xparts
[
jj
];
xparts
[
jj
]
=
temp_xp
;
memswap
(
&
ind
[
ii
],
&
ind
[
jj
],
sizeof
(
size_t
));
memswap
(
&
parts
[
ii
],
&
parts
[
jj
],
sizeof
(
struct
part
));
memswap
(
&
xparts
[
ii
],
&
xparts
[
jj
],
sizeof
(
struct
xpart
));
}
}
...
...
@@ -1226,12 +1221,8 @@ void space_gparts_sort_mapper(void *map_data, int num_elements,
while
(
ii
<=
j
&&
ind
[
ii
]
<=
pivot
)
ii
++
;
while
(
jj
>=
i
&&
ind
[
jj
]
>
pivot
)
jj
--
;
if
(
ii
<
jj
)
{
size_t
temp_i
=
ind
[
ii
];
ind
[
ii
]
=
ind
[
jj
];
ind
[
jj
]
=
temp_i
;
struct
gpart
temp_p
=
gparts
[
ii
];
gparts
[
ii
]
=
gparts
[
jj
];
gparts
[
jj
]
=
temp_p
;
memswap
(
&
ind
[
ii
],
&
ind
[
jj
],
sizeof
(
size_t
));
memswap
(
&
gparts
[
ii
],
&
gparts
[
jj
],
sizeof
(
size_t
));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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