summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2014-10-31 22:43:32 +1030
committerAdrian Johnson <ajohnson@redneon.com>2014-10-31 22:55:14 +1030
commitadbeb3d53c6c6e8ddcc63988200da4c5c9627717 (patch)
treebead332c389dc714a3cb608805df78c964c6e4b3
parente4b78424ac82588bcb9b855d5b6d5872050d33f9 (diff)
Improve performance of cpu_to_be32 and be32_to_cpu
By switching to the more common form, gcc and clang emit a single bswap instruction and truetype subsetting of large fonts runs about 15% faster.
-rw-r--r--src/cairoint.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairoint.h b/src/cairoint.h
index 07ced422d..5bca00389 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -229,7 +229,7 @@ be16_to_cpu(uint16_t v)
static inline uint32_t cairo_const
cpu_to_be32(uint32_t v)
{
- return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16);
+ return (v >> 24) | ((v >> 8) & 0xff00) | ((v << 8) & 0xff0000) | (v << 24);
}
static inline uint32_t cairo_const