--- glib-2.18/glib/ghash.c	2009-02-05 10:06:52.000000000 +0800
+++ glib-svn/glib/ghash.c	2009-02-09 10:17:00.000000000 +0800
@@ -126,19 +126,11 @@
 static void
 g_hash_table_set_shift (GHashTable *hash_table, gint shift)
 {
-  gint i;
-  guint mask = 0;
+  gint s = 1 << shift;
 
-  hash_table->size = 1 << shift;
+  hash_table->size = s;
   hash_table->mod  = prime_mod [shift];
-
-  for (i = 0; i < shift; i++)
-    {
-      mask <<= 1;
-      mask |= 1;
-    }
-
-  hash_table->mask = mask;
+  hash_table->mask = s - 1;
 }
 
 static gint
