mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-23 11:14:29 +00:00
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:
parent
c4992c75f7
commit
22f6ac039d
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue