diff --git a/include/nm-utils-internal.h b/include/nm-utils-internal.h index 059d2b7d75..2d87c7d6cb 100644 --- a/include/nm-utils-internal.h +++ b/include/nm-utils-internal.h @@ -181,4 +181,14 @@ nm_clear_g_source (guint *id) /*****************************************************************************/ +/* check if @flags has exactly one flag (@check) set. You should call this + * only with @check being a compile time constant and a power of two. */ +#define NM_FLAGS_HAS(flags, check) \ + ( (G_STATIC_ASSERT_EXPR ( ((check) != 0) && ((check) & ((check)-1)) == 0 )), (NM_FLAGS_ANY ((flags), (check))) ) + +#define NM_FLAGS_ANY(flags, check) ( ( ((flags) & (check)) != 0 ) ? TRUE : FALSE ) +#define NM_FLAGS_ALL(flags, check) ( ( ((flags) & (check)) == (check) ) ? TRUE : FALSE ) + +/*****************************************************************************/ + #endif diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 03836abd5d..10f1f12f63 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -53,15 +53,6 @@ int nm_spawn_process (const char *args, GError **error); int nm_utils_modprobe (GError **error, const char *arg1, ...) G_GNUC_NULL_TERMINATED; -/* check if @flags has exactly one flag (@check) set. You should call this - * only with @check being a compile time constant and a power of two. */ -#define NM_FLAGS_HAS(flags, check) \ - ( (G_STATIC_ASSERT_EXPR ( ((check) != 0) && ((check) & ((check)-1)) == 0 )), (NM_FLAGS_ANY ((flags), (check))) ) - -#define NM_FLAGS_ANY(flags, check) ( ( ((flags) & (check)) != 0 ) ? TRUE : FALSE ) -#define NM_FLAGS_ALL(flags, check) ( ( ((flags) & (check)) == (check) ) ? TRUE : FALSE ) - - /** * str_if_set: * @str: input string that will be returned if @str is not %NULL