Commit af4e99f8c8245ba4519b83db1d74fa42bd7c7426

Thomas de Grivel 2024-08-19T14:06:56

fix struct size for 32bit archs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/libkc3/struct_type.c b/libkc3/struct_type.c
index 16a4ad0..8514fe7 100644
--- a/libkc3/struct_type.c
+++ b/libkc3/struct_type.c
@@ -149,7 +149,10 @@ s_struct_type * struct_type_init (s_struct_type *st,
     i++;
     s = list_next(s);
   }
-  tmp.size = (offset + 15) / 16 * 16;
+  if (sizeof(long) == 4)
+    tmp.size = (offset + 3) / 4 * 4;
+  else
+    tmp.size = (offset + 15) / 16 * 16;
   *st = tmp;
   return st;
 }