glib-aux: use max_align_t in NM_HASH_COMBINE_VALS() macro

The _nm_alignas() exists to choose a suitable alignment. Since it's
on the stack, it has (almost) no overhead to just use the maximum
alignment.

That's why gint64 was chosen before. But that isn't the largest
alignment. We rely on C11 already, and we also always include <stddef.h>.
So use max_align_t instead.
This commit is contained in:
Thomas Haller 2022-07-14 20:29:43 +02:00
parent c4992c75f7
commit 22f6ac039d
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -140,7 +140,7 @@ nm_hash_update_bool(NMHashState *state, bool val)
#define NM_HASH_COMBINE_VALS(var, ...) \
const struct _nm_packed { \
NM_VA_ARGS_FOREACH(, , , _NM_HASH_COMBINE_VALS_TYPE_OP, __VA_ARGS__) \
} var _nm_alignas(guint64) = { \
} var _nm_alignas(max_align_t) = { \
NM_VA_ARGS_FOREACH(, , , _NM_HASH_COMBINE_VALS_INIT_OP, __VA_ARGS__)}
/* nm_hash_update_vals() is faster then nm_hash_update_val() as it combines multiple