[PATCH] CAIRO_BITSWAP8 costs seven operations on a 32 bit machine, but it can be done with only four operations on 64 bit machines. This patch accelerates CAIRO_BITSWAP8 on 64 bit machines.

Dongsheng Xing dongsheng.xing at intel.com
Tue May 29 01:14:19 PDT 2012


---
 src/cairoint.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/cairoint.h b/src/cairoint.h
index 2c9f2dd..96e2c1f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -169,7 +169,11 @@ do {					\
  * Devised by Sean Anderson, July 13, 2001.
  * Source: http://graphics.stanford.edu/~seander/bithacks.html#ReverseByte=
With32Bits
  */
+#if (SIZEOF_LONG >=3D 8)
+#define CAIRO_BITSWAP8(c) ((((c) * 0x80200802LU & 0x884422110LU) * 0x10101=
0101LU) >> 32)
+#else
 #define CAIRO_BITSWAP8(c) ((((c) * 0x0802LU & 0x22110LU) | ((c) * 0x8020LU=
 & 0x88440LU)) * 0x10101LU >> 16)
+#endif
=20
 /* Return the number of 1 bits in mask.
  *
--=20
1.7.9.5




More information about the cairo mailing list