Skip to content
Snippets Groups Projects
Commit 0b5bc853 authored by Matthieu Schaller's avatar Matthieu Schaller Committed by Matthieu Schaller
Browse files

Clearer bracketing of the nearest() function.

parent c0c39697
No related branches found
No related tags found
2 merge requests!566Periodic gravity calculation,!565Mesh force task
......@@ -49,10 +49,12 @@
* Similarly for dx < -b.
*
*/
__attribute__((always_inline)) INLINE static double nearest(double dx,
double box_size) {
return dx > 0.5 * box_size ? (dx - box_size)
: ((dx < -0.5 * box_size) ? (dx + box_size) : dx);
__attribute__((always_inline)) INLINE static double nearest(
const double dx, const double box_size) {
return ((dx > 0.5 * box_size)
? (dx - box_size)
: ((dx < -0.5 * box_size) ? (dx + box_size) : dx));
}
/**
......@@ -65,11 +67,12 @@ __attribute__((always_inline)) INLINE static double nearest(double dx,
* Similarly for dx < -b.
*
*/
__attribute__((always_inline)) INLINE static float nearestf(float dx,
float box_size) {
return dx > 0.5f * box_size
? (dx - box_size)
: ((dx < -0.5f * box_size) ? (dx + box_size) : dx);
__attribute__((always_inline)) INLINE static float nearestf(
const float dx, const float box_size) {
return ((dx > 0.5f * box_size)
? (dx - box_size)
: ((dx < -0.5f * box_size) ? (dx + box_size) : dx));
}
#endif /* SWIFT_PERIODIC_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment