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-private.h | |
parent | e7204a3631d29d334511f291db8c31ce0026e2ce (diff) |
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-private.h')
-rw-r--r-- | src/cairo-wideint-private.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cairo-wideint-private.h b/src/cairo-wideint-private.h index b9f8dae6..53d2546e 100644 --- a/src/cairo-wideint-private.h +++ b/src/cairo-wideint-private.h @@ -54,6 +54,8 @@ cairo_uquorem64_t I _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den); +cairo_uint64_t I _cairo_double_to_uint64 (double i); +double I _cairo_uint64_to_double (uint64_t i); cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i); #define _cairo_uint64_to_uint32(a) ((a).lo) cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b); @@ -103,6 +105,16 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den) return qr; } +/* + * These need to be functions or gcc will complain when used on the + * result of a function: + * + * warning: cast from function call of type ‘#cairo_uint64_t’ to + * non-matching type ‘double’ + */ +static cairo_always_inline cairo_uint64_t I _cairo_double_to_uint64 (double i) { return i; } +static cairo_always_inline double I _cairo_uint64_to_double (cairo_uint64_t i) { return i; } + #define _cairo_uint32_to_uint64(i) ((uint64_t) (i)) #define _cairo_uint64_to_uint32(i) ((uint32_t) (i)) #define _cairo_uint64_add(a,b) ((a) + (b)) |