summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-01-28 12:27:52 +0100
committerThomas Haller <thaller@redhat.com>2020-02-10 19:11:50 +0100
commit45a832ac50cda28913dcf3abbe629cb59955d09b (patch)
treea89559166f11131eebf9cd32b9be1318ede56333 /shared
parent5528086ec5f2929d25869141b4df7ae23b137faa (diff)
downloadNetworkManager-45a832ac50cda28913dcf3abbe629cb59955d09b.tar.gz
shared: add NM_FLAGS_ASSIGN_MASK() helper
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index 332abfac71..7c6a228057 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -1429,6 +1429,14 @@ fcn_name (lookup_type val) \
: _flags & (~_val); \
})
+#define NM_FLAGS_ASSIGN_MASK(flags, mask, val) ({ \
+ const typeof(flags) _flags = (flags); \
+ const typeof(flags) _mask = (mask); \
+ const typeof(flags) _val = (val); \
+ \
+ ((_flags & ~_mask) | (_mask & _val)); \
+ })
+
/*****************************************************************************/
#define _NM_BACKPORT_SYMBOL_IMPL(version, return_type, orig_func, versioned_func, args_typed, args) \