Author: sewardj
Date: 2008-01-13 01:47:56 +0000 (Sun, 13 Jan 2008)
New Revision: 7339

Log:
Make the argument to VG_(log2) be unsigned.  Doesn't really make sense
to interpret it as a signed value.

Modified:
   branches/DATASYMS/coregrind/m_libcbase.c
   branches/DATASYMS/include/pub_tool_libcbase.h


Modified: branches/DATASYMS/coregrind/m_libcbase.c
===================================================================
--- branches/DATASYMS/coregrind/m_libcbase.c    2008-01-11 07:24:37 UTC (rev 
7338)
+++ branches/DATASYMS/coregrind/m_libcbase.c    2008-01-13 01:47:56 UTC (rev 
7339)
@@ -563,13 +563,14 @@
    Misc useful functions
    ------------------------------------------------------------------ */
 
-/* Returns the base-2 logarithm of x.  Returns -1 if x is not a power of two. 
*/
-Int VG_(log2) ( Int x ) 
+/* Returns the base-2 logarithm of x.  Returns -1 if x is not a power
+   of two. */
+Int VG_(log2) ( UInt x ) 
 {
    Int i;
    /* Any more than 32 and we overflow anyway... */
    for (i = 0; i < 32; i++) {
-      if (1 << i == x) return i;
+      if ((1U << i) == x) return i;
    }
    return -1;
 }

Modified: branches/DATASYMS/include/pub_tool_libcbase.h
===================================================================
--- branches/DATASYMS/include/pub_tool_libcbase.h       2008-01-11 07:24:37 UTC 
(rev 7338)
+++ branches/DATASYMS/include/pub_tool_libcbase.h       2008-01-13 01:47:56 UTC 
(rev 7339)
@@ -135,8 +135,9 @@
 extern void VG_(ssort)( void* base, SizeT nmemb, SizeT size,
                         Int (*compar)(void*, void*) );
 
-/* Returns the base-2 logarithm of x.  Returns -1 if x is not a power of two. 
*/
-extern Int VG_(log2) ( Int x );
+/* Returns the base-2 logarithm of x.  Returns -1 if x is not a power
+   of two. */
+extern Int VG_(log2) ( UInt x );
 
 // A pseudo-random number generator returning a random UInt.  If pSeed
 // is NULL, it uses its own seed, which starts at zero.  If pSeed is


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to