diff options
author | Thomas Haller <thaller@redhat.com> | 2017-06-20 10:19:37 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-07-05 14:22:10 +0200 |
commit | 489e346e87d8c63e563bda2e001039121b805771 (patch) | |
tree | 940773be08265d647e6693e65b7eb2a45b3ad840 | |
parent | b002357f5f77887d5bc11e0534ddaa46664f1af2 (diff) | |
download | NetworkManager-489e346e87d8c63e563bda2e001039121b805771.tar.gz |
shared: add NM_HASH_COMBINE() function
-rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index 011f45d0ee..05e3ed7631 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -381,6 +381,15 @@ _NM_IN_STRSET_streq (const char *x, const char *s) /*****************************************************************************/ +static inline guint +NM_HASH_COMBINE (guint h, guint val) +{ + /* see g_str_hash() for reasons */ + return (h << 5) + h + val; +} + +/*****************************************************************************/ + /* NM_CACHED_QUARK() returns the GQuark for @string, but caches * it in a static variable to speed up future lookups. * |