From a7fcb197fbb2bc2e2579ac22d0b6bd1c6cc309a7 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Fri, 23 Dec 2016 15:10:35 +0000
Subject: [PATCH] Apply Clang's padding advice to structures.

---
 src/engine.c                       | 2 +-
 src/gravity/Default/gravity_part.h | 8 ++++----
 src/threadpool.h                   | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 443be97cb4..6b3f5650f0 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -2434,7 +2434,7 @@ void engine_collect_timestep(struct engine *e) {
     ti_end_min = in_i[0];
   }
   {
-    unsigned long long in_ll[2], out_ll[2];
+    long long in_ll[2], out_ll[2];
     out_ll[0] = updates;
     out_ll[1] = g_updates;
     if (MPI_Allreduce(out_ll, in_ll, 2, MPI_LONG_LONG_INT, MPI_SUM,
diff --git a/src/gravity/Default/gravity_part.h b/src/gravity/Default/gravity_part.h
index f06e65e5b3..6b070ebc22 100644
--- a/src/gravity/Default/gravity_part.h
+++ b/src/gravity/Default/gravity_part.h
@@ -25,6 +25,10 @@
 /* Gravity particle. */
 struct gpart {
 
+  /* Particle ID. If negative, it is the negative offset of the #part with
+     which this gpart is linked. */
+  long long id_or_neg_offset;
+
   /* Particle position. */
   double x[3];
 
@@ -49,10 +53,6 @@ struct gpart {
   /* Particle time of end of time-step. */
   int ti_end;
 
-  /* Particle ID. If negative, it is the negative offset of the #part with
-     which this gpart is linked. */
-  long long id_or_neg_offset;
-
 } SWIFT_STRUCT_ALIGN;
 
 #endif /* SWIFT_DEFAULT_GRAVITY_PART_H */
diff --git a/src/threadpool.h b/src/threadpool.h
index 76aa0c1196..f9c7eeffb7 100644
--- a/src/threadpool.h
+++ b/src/threadpool.h
@@ -32,9 +32,6 @@ typedef void (*threadpool_map_function)(void *map_data, int num_elements,
 /* Data of a threadpool. */
 struct threadpool {
 
-  /* Number of threads in this pool. */
-  int num_threads;
-
   /* The threads themselves. */
   pthread_t *threads;
 
@@ -48,6 +45,9 @@ struct threadpool {
       map_data_chunk;
   volatile threadpool_map_function map_function;
 
+  /* Number of threads in this pool. */
+  int num_threads;
+
   /* Counter for the number of threads that are done. */
   volatile int num_threads_waiting, num_threads_running;
 };
-- 
GitLab