Commit 6788abaa authored by Elliot Lee's avatar Elliot Lee

added g_direct_hash and g_direct_compare functions, since I happen to use them in a *lot* of places

parent 39a05c0b
......@@ -782,7 +782,11 @@ GArray* g_rarray_truncate (GArray *array,
gint g_str_equal (const gpointer v,
const gpointer v2);
guint g_str_hash (const gpointer v);
/* These two "hash" functions actually just return the value and/or
comparison of the pointers themselves - useful for hashing
on an int value or something like that */
gint g_direct_compare(gpointer a, gpointer b);
guint g_direct_hash(gpointer key);
/* GScanner: Flexible lexical scanner for general purpose.
......
......@@ -909,3 +909,14 @@ g_parse_debug_string (const gchar *string,
return result;
}
guint
g_direct_hash(gpointer key)
{
return (guint)key;
}
gint
g_direct_compare(gpointer a, gpointer b)
{
return (gint)b - (gint)a;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment