[cairo-bugs] [Bug 50408] New: [patch] Accelerate CAIRO_BITSWAP8 on 64 bit machines

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 27 22:27:28 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=50408

             Bug #: 50408
           Summary: [patch] Accelerate CAIRO_BITSWAP8 on 64 bit machines
    Classification: Unclassified
           Product: cairo
           Version: 1.12.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
        AssignedTo: cworth at cworth.org
        ReportedBy: dongsheng.xing at intel.com
         QAContact: cairo-bugs at cairographics.org


Hi, 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.

diff --git a/src/cairoint.h b/src/cairoint.h
index 2c9f2dd..7e62d86 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#ReverseByteWith32Bits
  */
+#if (SIZEOF_VOID_P >= 8)
+#define CAIRO_BITSWAP8(c) ((((c) * 0x80200802LLU & 0x884422110LLU) *
0x101010101LLU) >> 32)
+#else
 #define CAIRO_BITSWAP8(c) ((((c) * 0x0802LU & 0x22110LU) | ((c) * 0x8020LU &
0x88440LU)) * 0x10101LU >> 16)
+#endif

 /* Return the number of 1 bits in mask.
  *

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the cairo-bugs mailing list