summaryrefslogtreecommitdiff
path: root/src/cairo-wideint.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-08-30 16:15:28 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-09-02 12:27:13 +0200
commit0101a545793291d0fe76b765ba8392ade5faa1a1 (patch)
tree7294a6416e8036672b41cae84c3f2ff6849154f3 /src/cairo-wideint.c
parente7204a3631d29d334511f291db8c31ce0026e2ce (diff)
downloadcairo-0101a545793291d0fe76b765ba8392ade5faa1a1.tar.gz
time: Add cairo_time_t type
Add the cairo_time_t type (currently based on cairo_uint64_t) and use it in cairo-observer and in the perf suite. Fixes the build on MacOS X (for the src/ subdir) and Win32, whch failed because they don't provide clock_gettime: cairo-surface-observer.c:629: error: implicit declaration of function 'clock_gettime' cairo-surface-observer.c:629: warning: nested extern declaration of 'clock_gettime' cairo-surface-observer.c:629: error: 'CLOCK_MONOTONIC' undeclared (first use in this function) ...
Diffstat (limited to 'src/cairo-wideint.c')
-rw-r--r--src/cairo-wideint.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c
index 78dedcdf0..b6e22808d 100644
--- a/src/cairo-wideint.c
+++ b/src/cairo-wideint.c
@@ -84,6 +84,22 @@ uint64_shift32 (cairo_uint64_t i)
static const cairo_uint64_t uint64_carry32 = { 0, 1 };
cairo_uint64_t
+_cairo_double_to_uint64 (double i)
+{
+ cairo_uint64_t q;
+
+ q.hi = i * (1. / 4294967296.);
+ q.lo = i - q.hi * 4294967296.;
+ return q;
+}
+
+double
+_cairo_uint64_to_double (cairo_uint64_t i)
+{
+ return i.hi * 4294967296. + i.lo;
+}
+
+cairo_uint64_t
_cairo_uint32_to_uint64 (uint32_t i)
{
cairo_uint64_t q;