diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-08-30 16:15:28 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-09-02 12:27:13 +0200 |
commit | 0101a545793291d0fe76b765ba8392ade5faa1a1 (patch) | |
tree | 7294a6416e8036672b41cae84c3f2ff6849154f3 /src/cairo-wideint.c | |
parent | e7204a3631d29d334511f291db8c31ce0026e2ce (diff) | |
download | cairo-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.c | 16 |
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; |