64-bit cleanliness fixes.
authorManish Singh <yosh@gimp.org>
Sat, 10 Jan 2004 08:15:24 +0000 (08:15 +0000)
committerManish Singh <yosh@src.gnome.org>
Sat, 10 Jan 2004 08:15:24 +0000 (08:15 +0000)
Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>

        * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
        fixes.

        * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
        above take gulongs now. My docs suck, someone should revisit it.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/glib/tmpl/misc_utils.sgml
glib/gutils.h

index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 8027e9e6f4eeb932e33503f723e0e9d3a3479894..a9f7c27065e63b47d15b5fa196255352f370de9d 100644 (file)
@@ -1,3 +1,11 @@
+Sat Jan 10 00:11:12 2004  Manish Singh  <yosh@gimp.org>
+
+       * glib/gutils.h (g_bit_nth_lsf,g_bit_nth_msf): 64-bit cleanliness
+       fixes.
+
+       * docs/reference/glib/tmpl/misc_utils.sgml: update to reflect the
+       above take gulongs now. My docs suck, someone should revisit it.
+
 Fri Dec 19 11:49:21 2003  George Lebl <jirka@5z.com>
 
         * glib/grand.c
index 13a43674bc459d33124b2cef2b031eb9020187c2..426c5fe3daf3c6929228a5904b8531a2c7d425d1 100644 (file)
@@ -225,10 +225,11 @@ freed when no longer needed.
 <para>
 Find the position of the first bit set in @mask, searching from (but not
 including) @nth_bit upwards. Bits are numbered from 0 (least significant)
-to 31. To start searching from the 0th bit, set @nth_bit to -1.
+to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
+0th bit, set @nth_bit to -1.
 </para>
 
-@mask: a #guint32 containing up to 32 bit flags.
+@mask: a #gulong containing flags.
 @nth_bit: the index of the bit to start the search from.
 @Returns: the index of the first bit set which is higher than @nth_bit.
 
@@ -237,10 +238,11 @@ to 31. To start searching from the 0th bit, set @nth_bit to -1.
 <para>
 Find the position of the first bit set in @mask, searching from (but not
 including) @nth_bit downwards. Bits are numbered from 0 (least significant)
-to 31. To start searching from the 31st bit, set @nth_bit to 32 or -1.
+to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
+last bit, set @nth_bit to -1 or GLIB_SIZEOF_LONG * 8.
 </para>
 
-@mask: a #guint32 containing up to 32 bit flags.
+@mask: a #gulong containing flags.
 @nth_bit: the index of the bit to start the search from.
 @Returns: the index of the first bit set which is lower than @nth_bit.
 
index eae7d825b8edb56c2a66b42ad4ecd1d64fc8065d..c5c1300798fdd3ea14a45bc96d45effdee67a172 100644 (file)
@@ -236,10 +236,10 @@ g_bit_nth_lsf (gulong mask,
   do
     {
       nth_bit++;
-      if (mask & (1 << (gulong) nth_bit))
+      if (mask & (1UL << nth_bit))
        return nth_bit;
     }
-  while (nth_bit < 31);
+  while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1));
   return -1;
 }
 G_INLINE_FUNC gint
@@ -251,7 +251,7 @@ g_bit_nth_msf (gulong mask,
   do
     {
       nth_bit--;
-      if (mask & (1 << (gulong) nth_bit))
+      if (mask & (1UL << nth_bit))
        return nth_bit;
     }
   while (nth_bit > 0);