mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 12:37:58 +02:00
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@gnu.org>
This commit is contained in:
parent
9e332eadad
commit
a2ec383ff1
2 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -804,15 +804,15 @@ fbRasterizeTrapezoid (pixman_image_t *pMask,
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue