diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-04-30 22:39:26 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-04-30 22:39:58 -0400 |
commit | 417eb0ad9c3d32b9398d0b27e55ea48b8e399732 (patch) | |
tree | 892b0cbbc8f16692f8ea812e4802a9b76488c897 /gtk/gtkroundedbox.c | |
parent | e5de6dd8b13c62a9a4cea65f223ed963c8537c8d (diff) | |
download | gtk+-417eb0ad9c3d32b9398d0b27e55ea48b8e399732.tar.gz |
Use a better hash for arcs
Diffstat (limited to 'gtk/gtkroundedbox.c')
-rw-r--r-- | gtk/gtkroundedbox.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c index 67aed7a786..a6d9019b4d 100644 --- a/gtk/gtkroundedbox.c +++ b/gtk/gtkroundedbox.c @@ -228,10 +228,25 @@ typedef struct { gboolean negative; } Arc; +static inline guint +mem_hash (gconstpointer v, gint len) +{ + const signed char *p; + const signed char *end; + guint32 h = 5381; + + p = v; + end = p + len; + for (; p < end; p++) + h = (h << 5) + h + *p; + + return h; +} + static guint arc_path_hash (Arc *arc) { - return g_double_hash (&arc->angle1) ^ g_double_hash (&arc->angle2) ^ arc->negative; + return mem_hash ((gconstpointer)arc, sizeof (Arc)); } static gboolean |