[cairo-commit] pixman/src

Carl Worth cworth at kemper.freedesktop.org
Tue Jan 16 16:38:45 PST 2007


 pixman/src/iccolor.c |    4 ++--
 pixman/src/icint.h   |   12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
diff-tree a2ec383ff128617d33efa5760ec4b5f9688e8a13 (from 9e332eadad00e115fdcdbc816608a0537f5a9b9c)
Author: Pavel Roskin <proski at gnu.org>
Date:   Sun Aug 13 01:57:56 2006 -0400

    Clean up _fbOnes()
    
    The implementation of _FbOnes in iccolor.c would not work on 64-bit
    longs correctly.  Fortunately, it's only used on integers, so make it
    explicit in the declaration.
    
    Use an inline function for the gcc builtin implementation to make sure
    that it's never used with arguments of incorrect size.
    
    There is no __INT_MIN__ in gcc 4.1.1, but it's not an issue now because
    the argument is 32-bit.
    
    Signed-off-by: Pavel Roskin <proski at gnu.org>

diff --git a/pixman/src/iccolor.c b/pixman/src/iccolor.c
index 26b4aaf..9dd8f5e 100644
--- a/pixman/src/iccolor.c
+++ b/pixman/src/iccolor.c
@@ -26,9 +26,9 @@
 #ifdef ICINT_NEED_IC_ONES
 /* Fall back on HACKMEM 169.  */
 int
-_FbOnes (unsigned long mask)
+_FbOnes (unsigned int mask)
 {
-    register unsigned long y;
+    register int y;
 
     y = (mask >> 1) &033333333333;
     y = mask - y - ((y >>1) & 033333333333);
diff --git a/pixman/src/icint.h b/pixman/src/icint.h
index 17b13b4..93795b0 100644
--- a/pixman/src/icint.h
+++ b/pixman/src/icint.h
@@ -804,15 +804,15 @@ fbRasterizeTrapezoid (pixman_image_t		*p
    in libgcc in case a target does not have one, which should be just as
    good as the static function below.  */
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# if __INT_MIN__ == 0x7fffffff
-#  define _FbOnes(mask)		__builtin_popcount(mask)
-# else
-#  define _FbOnes(mask)		__builtin_popcountl((mask) & 0xffffffff)
-# endif
+static INLINE int
+_FbOnes(unsigned int mask)
+{
+	return __builtin_popcount(mask);
+}
 #else
 # define ICINT_NEED_IC_ONES
 pixman_private int
-_FbOnes(unsigned long mask);
+_FbOnes(unsigned int mask);
 #endif
 
 /* icformat.c */


More information about the cairo-commit mailing list