Bug 50408 - [patch] Accelerate CAIRO_BITSWAP8 on 64 bit machines
Summary: [patch] Accelerate CAIRO_BITSWAP8 on 64 bit machines
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.12.2
Hardware: All All
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-27 22:27 UTC by Homer Hsing
Modified: 2018-08-25 13:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Homer Hsing 2012-05-27 22:27:28 UTC
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.
  *
Comment 1 GitLab Migration User 2018-08-25 13:29:17 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/28.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.