diff options
author | Thomas Haller <thaller@redhat.com> | 2020-01-28 12:27:52 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-02-10 19:11:50 +0100 |
commit | 45a832ac50cda28913dcf3abbe629cb59955d09b (patch) | |
tree | a89559166f11131eebf9cd32b9be1318ede56333 /shared | |
parent | 5528086ec5f2929d25869141b4df7ae23b137faa (diff) | |
download | NetworkManager-45a832ac50cda28913dcf3abbe629cb59955d09b.tar.gz |
shared: add NM_FLAGS_ASSIGN_MASK() helper
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 8 |
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) \ |