summaryrefslogtreecommitdiff
path: root/src/cairo-wideint.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-09-15 17:26:59 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2009-09-15 18:19:08 +0100
commit56c9b2de7a2b93b2e0c59cf98326d8c0d4d508ba (patch)
tree2c4bf3988fa523e971089654ee604a7785cd106f /src/cairo-wideint.c
parentccf84a8883ebb8d2ee8f55eb53da4dfc96887de0 (diff)
Use __uint128_t and __int128_t if available
GCC uses a peculiar name for a real 128-bit integer on x86-64. Speedups, xlib on a gm45 ======================== poppler 41246.56 -> 35102.82: 1.18x speedup swfdec-youtube 12623.01 -> 11936.79: 1.06x speedup Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-wideint.c')
-rw-r--r--src/cairo-wideint.c91
1 files changed, 42 insertions, 49 deletions
diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c
index 1843a602..2c70d866 100644
--- a/src/cairo-wideint.c
+++ b/src/cairo-wideint.c
@@ -37,10 +37,52 @@
#if HAVE_UINT64_T
+#define uint64_lo32(i) ((i) & 0xffffffff)
+#define uint64_hi32(i) ((i) >> 32)
+#define uint64_lo(i) ((i) & 0xffffffff)
+#define uint64_hi(i) ((i) >> 32)
+#define uint64_shift32(i) ((i) << 32)
+#define uint64_carry32 (((uint64_t) 1) << 32)
+
#define _cairo_uint32s_to_uint64(h,l) ((uint64_t) (h) << 32 | (l))
#else
+#define uint64_lo32(i) ((i).lo)
+#define uint64_hi32(i) ((i).hi)
+
+static cairo_uint64_t
+uint64_lo (cairo_uint64_t i)
+{
+ cairo_uint64_t s;
+
+ s.lo = i.lo;
+ s.hi = 0;
+ return s;
+}
+
+static cairo_uint64_t
+uint64_hi (cairo_uint64_t i)
+{
+ cairo_uint64_t s;
+
+ s.lo = i.hi;
+ s.hi = 0;
+ return s;
+}
+
+static cairo_uint64_t
+uint64_shift32 (cairo_uint64_t i)
+{
+ cairo_uint64_t s;
+
+ s.lo = 0;
+ s.hi = i.lo;
+ return s;
+}
+
+static const cairo_uint64_t uint64_carry32 = { 0, 1 };
+
cairo_uint64_t
_cairo_uint32_to_uint64 (uint32_t i)
{
@@ -308,7 +350,6 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den)
#endif /* !HAVE_UINT64_T */
#if HAVE_UINT128_T
-
cairo_uquorem128_t
_cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den)
{
@@ -385,54 +426,6 @@ _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b)
return s;
}
-#if HAVE_UINT64_T
-
-#define uint64_lo32(i) ((i) & 0xffffffff)
-#define uint64_hi32(i) ((i) >> 32)
-#define uint64_lo(i) ((i) & 0xffffffff)
-#define uint64_hi(i) ((i) >> 32)
-#define uint64_shift32(i) ((i) << 32)
-#define uint64_carry32 (((uint64_t) 1) << 32)
-
-#else
-
-#define uint64_lo32(i) ((i).lo)
-#define uint64_hi32(i) ((i).hi)
-
-static cairo_uint64_t
-uint64_lo (cairo_uint64_t i)
-{
- cairo_uint64_t s;
-
- s.lo = i.lo;
- s.hi = 0;
- return s;
-}
-
-static cairo_uint64_t
-uint64_hi (cairo_uint64_t i)
-{
- cairo_uint64_t s;
-
- s.lo = i.hi;
- s.hi = 0;
- return s;
-}
-
-static cairo_uint64_t
-uint64_shift32 (cairo_uint64_t i)
-{
- cairo_uint64_t s;
-
- s.lo = 0;
- s.hi = i.lo;
- return s;
-}
-
-static const cairo_uint64_t uint64_carry32 = { 0, 1 };
-
-#endif
-
cairo_uint128_t
_cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b)
{