author | Mathieu Lacage <mathieu.lacage@gmail.com> |
Wed, 03 Aug 2011 13:58:10 -0400 | |
changeset 7399 | 520706f801e8 |
parent 7256 | b04ba6772f8c |
child 10610 | 540e54a98bc8 |
permissions | -rw-r--r-- |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* cairo - a vector graphics library with display and print output |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* Copyright © 2004 Keith Packard |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* The original code as contributed to the cairo library under |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
* the dual license MPL+LGPL. We used the LGPL relicensing clause to |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
* get a GPL version of this code which now lives here. This header is |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
* unmodified other than the licensing clause. |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
* The Original Code is the cairo graphics library. |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
* The Initial Developer of the Original Code is Keith Packard |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
* Contributor(s): |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
* Keith R. Packard <keithp@keithp.com> |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
*/ |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
#ifndef CAIRO_WIDEINT_H |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
#define CAIRO_WIDEINT_H |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
6821
203367ae7433
merge src/simulator into src/core; move src/core to new module layout
Tom Henderson <tomh@tomh.org>
parents:
5398
diff
changeset
|
35 |
#include "ns3/core-config.h" |
165
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
36 |
#define cairo_private |
169
bc06726969af
fix typo and make sure we use uint64 native type by default.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
165
diff
changeset
|
37 |
#define HAVE_UINT64_T 1 |
165
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
38 |
|
5398
bdc7094e9c47
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under Cygwin
fmoatamr
parents:
5386
diff
changeset
|
39 |
/*for compatibility with MacOS and Cygwin*/ |
5386
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
40 |
#ifndef HAVE_STDINT_H |
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
41 |
#ifdef __APPLE__ |
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
42 |
#define HAVE_STDINT_H 1 |
5398
bdc7094e9c47
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under Cygwin
fmoatamr
parents:
5386
diff
changeset
|
43 |
#elif defined(WIN32) |
bdc7094e9c47
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under Cygwin
fmoatamr
parents:
5386
diff
changeset
|
44 |
#define HAVE_STDINT_H 1 |
5386
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
45 |
#endif |
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
46 |
#endif |
e989563ab376
Fix the compiling error: \"Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)\" under MacOS
fmoatamr
parents:
169
diff
changeset
|
47 |
|
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
#if HAVE_STDINT_H |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
# include <stdint.h> |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
#elif HAVE_INTTYPES_H |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
# include <inttypes.h> |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
#elif HAVE_SYS_INT_TYPES_H |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
# include <sys/int_types.h> |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
#elif defined(_MSC_VER) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
55 |
typedef __int8 int8_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
56 |
typedef unsigned __int8 uint8_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
57 |
typedef __int16 int16_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
58 |
typedef unsigned __int16 uint16_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
59 |
typedef __int32 int32_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
60 |
typedef unsigned __int32 uint32_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
61 |
typedef __int64 int64_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
62 |
typedef unsigned __int64 uint64_t; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
# ifndef HAVE_UINT64_T |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
# define HAVE_UINT64_T 1 |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
# endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
# ifndef INT16_MIN |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
67 |
# define INT16_MIN (-32767-1) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
# endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
69 |
# ifndef INT16_MAX |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
70 |
# define INT16_MAX (32767) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
# endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
# ifndef UINT16_MAX |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
73 |
# define UINT16_MAX (65535) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
# endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
#else |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
76 |
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
#endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
|
165
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
79 |
#ifdef __cplusplus |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
80 |
extern "C" { |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
81 |
#endif |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
82 |
|
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
/* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
* 64-bit datatypes. Two separate implementations, one using |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
* built-in 64-bit signed/unsigned types another implemented |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
* as a pair of 32-bit ints |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
*/ |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
89 |
#define I cairo_private |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
90 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
#if !HAVE_UINT64_T |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
typedef struct _cairo_uint64 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
94 |
uint32_t lo, hi; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
} cairo_uint64_t, cairo_int64_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
97 |
cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
98 |
#define _cairo_uint64_to_uint32(a) ((a).lo) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
99 |
cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
100 |
cairo_uint64_t I _cairo_uint64_sub (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
101 |
cairo_uint64_t I _cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
102 |
cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
103 |
cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
104 |
cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
105 |
cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
106 |
int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
107 |
int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
108 |
cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
109 |
#define _cairo_uint64_negative(a) (((int32_t)((a).hi)) < 0) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
110 |
cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
112 |
#define _cairo_uint64_to_int64(i) (i) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
113 |
#define _cairo_int64_to_uint64(i) (i) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
115 |
cairo_int64_t I _cairo_int32_to_int64 (int32_t i); |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
116 |
#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32 (a)) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
117 |
#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
118 |
#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
119 |
#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
120 |
cairo_int64_t I _cairo_int32x32_64_mul (int32_t a, int32_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
121 |
int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
122 |
#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
123 |
#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
124 |
#define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
125 |
#define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
126 |
#define _cairo_int64_negate(a) _cairo_uint64_negate (a) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
127 |
#define _cairo_int64_negative(a) (((int32_t)((a).hi)) < 0) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
128 |
#define _cairo_int64_not(a) _cairo_uint64_not (a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
#else |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
typedef uint64_t cairo_uint64_t; |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
133 |
typedef int64_t cairo_int64_t; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
135 |
#define _cairo_uint32_to_uint64(i) ((uint64_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
136 |
#define _cairo_uint64_to_uint32(i) ((uint32_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
137 |
#define _cairo_uint64_add(a,b) ((a) + (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
138 |
#define _cairo_uint64_sub(a,b) ((a) - (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
139 |
#define _cairo_uint64_mul(a,b) ((a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
140 |
#define _cairo_uint32x32_64_mul(a,b) ((uint64_t)(a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
141 |
#define _cairo_uint64_lsl(a,b) ((a) << (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
142 |
#define _cairo_uint64_rsl(a,b) ((uint64_t)(a) >> (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
143 |
#define _cairo_uint64_rsa(a,b) ((uint64_t)((int64_t)(a) >> (b))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
144 |
#define _cairo_uint64_lt(a,b) ((a) < (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
145 |
#define _cairo_uint64_eq(a,b) ((a) == (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
146 |
#define _cairo_uint64_negate(a) ((uint64_t) -((int64_t)(a))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
147 |
#define _cairo_uint64_negative(a) ((int64_t)(a) < 0) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
148 |
#define _cairo_uint64_not(a) (~(a)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
150 |
#define _cairo_uint64_to_int64(i) ((int64_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
151 |
#define _cairo_int64_to_uint64(i) ((uint64_t)(i)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
153 |
#define _cairo_int32_to_int64(i) ((int64_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
154 |
#define _cairo_int64_to_int32(i) ((int32_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
155 |
#define _cairo_int64_add(a,b) ((a) + (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
156 |
#define _cairo_int64_sub(a,b) ((a) - (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
157 |
#define _cairo_int64_mul(a,b) ((a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
158 |
#define _cairo_int32x32_64_mul(a,b) ((int64_t)(a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
159 |
#define _cairo_int64_lt(a,b) ((a) < (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
160 |
#define _cairo_int64_eq(a,b) ((a) == (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
161 |
#define _cairo_int64_lsl(a,b) ((a) << (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
162 |
#define _cairo_int64_rsl(a,b) ((int64_t)((uint64_t)(a) >> (b))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
163 |
#define _cairo_int64_rsa(a,b) ((int64_t)(a) >> (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
164 |
#define _cairo_int64_negate(a) (-(a)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
165 |
#define _cairo_int64_negative(a) ((a) < 0) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
166 |
#define _cairo_int64_not(a) (~(a)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
167 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
#endif |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
169 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
/* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
171 |
* 64-bit comparisions derived from lt or eq |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
172 |
*/ |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
173 |
#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
174 |
#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
175 |
#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
176 |
#define _cairo_uint64_gt(a,b) _cairo_uint64_lt (b,a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
178 |
#define _cairo_int64_le(a,b) (!_cairo_int64_gt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
179 |
#define _cairo_int64_ne(a,b) (!_cairo_int64_eq (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
180 |
#define _cairo_int64_ge(a,b) (!_cairo_int64_lt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
181 |
#define _cairo_int64_gt(a,b) _cairo_int64_lt (b,a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
182 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
183 |
/* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
184 |
* As the C implementation always computes both, create |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
185 |
* a function which returns both for the 'native' type as well |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
186 |
*/ |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
187 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
188 |
typedef struct _cairo_uquorem64 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
189 |
cairo_uint64_t quo; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
190 |
cairo_uint64_t rem; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
191 |
} cairo_uquorem64_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
192 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
193 |
typedef struct _cairo_quorem64 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
194 |
cairo_int64_t quo; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
195 |
cairo_int64_t rem; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
196 |
} cairo_quorem64_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
197 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
198 |
cairo_uquorem64_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
199 |
_cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den); |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
200 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
201 |
cairo_quorem64_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
202 |
_cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den); |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
203 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
204 |
/* |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
205 |
* 128-bit datatypes. Again, provide two implementations in |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
206 |
* case the machine has a native 128-bit datatype. GCC supports int128_t |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
207 |
* on ia64 |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
208 |
*/ |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
209 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
210 |
#if !HAVE_UINT128_T |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
211 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
212 |
typedef struct cairo_uint128 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
213 |
cairo_uint64_t lo, hi; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
214 |
} cairo_uint128_t, cairo_int128_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
215 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
216 |
cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
217 |
cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
218 |
#define _cairo_uint128_to_uint64(a) ((a).lo) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
219 |
#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32 (_cairo_uint128_to_uint64 (a)) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
220 |
cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
221 |
cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
222 |
cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
223 |
cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
224 |
cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
225 |
cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
226 |
cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
227 |
int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
228 |
int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
229 |
cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
230 |
#define _cairo_uint128_negative(a) (_cairo_uint64_negative (a.hi)) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
231 |
cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
232 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
233 |
#define _cairo_uint128_to_int128(i) (i) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
234 |
#define _cairo_int128_to_uint128(i) (i) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
235 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
236 |
cairo_int128_t I _cairo_int32_to_int128 (int32_t i); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
237 |
cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
238 |
#define _cairo_int128_to_int64(a) ((cairo_int64_t)(a).lo) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
239 |
#define _cairo_int128_to_int32(a) _cairo_int64_to_int32 (_cairo_int128_to_int64 (a)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
240 |
#define _cairo_int128_add(a,b) _cairo_uint128_add (a,b) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
241 |
#define _cairo_int128_sub(a,b) _cairo_uint128_sub (a,b) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
242 |
#define _cairo_int128_mul(a,b) _cairo_uint128_mul (a,b) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
243 |
cairo_int128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
244 |
#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl (a,b) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
245 |
#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl (a,b) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
246 |
#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa (a,b) |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
247 |
int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
248 |
#define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) |
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
249 |
#define _cairo_int128_negate(a) _cairo_uint128_negate (a) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
250 |
#define _cairo_int128_negative(a) (_cairo_uint128_negative (a)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
251 |
#define _cairo_int128_not(a) _cairo_uint128_not (a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
252 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
253 |
#else /* !HAVE_UINT128_T */ |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
254 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
255 |
typedef uint128_t cairo_uint128_t; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
256 |
typedef int128_t cairo_int128_t; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
257 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
258 |
#define _cairo_uint32_to_uint128(i) ((uint128_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
259 |
#define _cairo_uint64_to_uint128(i) ((uint128_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
260 |
#define _cairo_uint128_to_uint64(i) ((uint64_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
261 |
#define _cairo_uint128_to_uint32(i) ((uint32_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
262 |
#define _cairo_uint128_add(a,b) ((a) + (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
263 |
#define _cairo_uint128_sub(a,b) ((a) - (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
264 |
#define _cairo_uint128_mul(a,b) ((a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
265 |
#define _cairo_uint64x64_128_mul(a,b) ((uint128_t)(a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
266 |
#define _cairo_uint128_lsl(a,b) ((a) << (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
267 |
#define _cairo_uint128_rsl(a,b) ((uint128_t)(a) >> (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
268 |
#define _cairo_uint128_rsa(a,b) ((uint128_t)((int128_t)(a) >> (b))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
269 |
#define _cairo_uint128_lt(a,b) ((a) < (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
270 |
#define _cairo_uint128_eq(a,b) ((a) == (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
271 |
#define _cairo_uint128_negate(a) ((uint128_t) -((int128_t)(a))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
272 |
#define _cairo_uint128_negative(a) ((int128_t)(a) < 0) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
273 |
#define _cairo_uint128_not(a) (~(a)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
274 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
275 |
#define _cairo_uint128_to_int128(i) ((int128_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
276 |
#define _cairo_int128_to_uint128(i) ((uint128_t)(i)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
277 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
278 |
#define _cairo_int32_to_int128(i) ((int128_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
279 |
#define _cairo_int64_to_int128(i) ((int128_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
280 |
#define _cairo_int128_to_int64(i) ((int64_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
281 |
#define _cairo_int128_to_int32(i) ((int32_t)(i)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
282 |
#define _cairo_int128_add(a,b) ((a) + (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
283 |
#define _cairo_int128_sub(a,b) ((a) - (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
284 |
#define _cairo_int128_mul(a,b) ((a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
285 |
#define _cairo_int64x64_128_mul(a,b) ((int128_t)(a) * (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
286 |
#define _cairo_int128_lt(a,b) ((a) < (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
287 |
#define _cairo_int128_eq(a,b) ((a) == (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
288 |
#define _cairo_int128_lsl(a,b) ((a) << (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
289 |
#define _cairo_int128_rsl(a,b) ((int128_t)((uint128_t)(a) >> (b))) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
290 |
#define _cairo_int128_rsa(a,b) ((int128_t)(a) >> (b)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
291 |
#define _cairo_int128_negate(a) (-(a)) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
292 |
#define _cairo_int128_negative(a) ((a) < 0) |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
293 |
#define _cairo_int128_not(a) (~(a)) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
294 |
|
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
295 |
#endif /* HAVE_UINT128_T */ |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
296 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
297 |
typedef struct _cairo_uquorem128 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
298 |
cairo_uint128_t quo; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
299 |
cairo_uint128_t rem; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
300 |
} cairo_uquorem128_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
302 |
typedef struct _cairo_quorem128 { |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
303 |
cairo_int128_t quo; |
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
304 |
cairo_int128_t rem; |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
305 |
} cairo_quorem128_t; |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
306 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
307 |
cairo_uquorem128_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
308 |
_cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den); |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
309 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
310 |
cairo_quorem128_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
311 |
_cairo_int128_divrem (cairo_int128_t num, cairo_int128_t den); |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
312 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
313 |
cairo_uquorem64_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
314 |
_cairo_uint_96by64_32x64_divrem (cairo_uint128_t num, |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
315 |
cairo_uint64_t den); |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
316 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
317 |
cairo_quorem64_t I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
318 |
_cairo_int_96by64_32x64_divrem (cairo_int128_t num, |
7169
358f71a624d8
core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6821
diff
changeset
|
319 |
cairo_int64_t den); |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
320 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
321 |
#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
322 |
#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
323 |
#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
324 |
#define _cairo_uint128_gt(a,b) _cairo_uint128_lt (b,a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
325 |
|
7256
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
326 |
#define _cairo_int128_le(a,b) (!_cairo_int128_gt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
327 |
#define _cairo_int128_ne(a,b) (!_cairo_int128_eq (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
328 |
#define _cairo_int128_ge(a,b) (!_cairo_int128_lt (a,b)) |
b04ba6772f8c
rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents:
7169
diff
changeset
|
329 |
#define _cairo_int128_gt(a,b) _cairo_int128_lt (b,a) |
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
330 |
|
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
331 |
#undef I |
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
332 |
|
165
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
333 |
#ifdef __cplusplus |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
334 |
}; |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
335 |
#endif |
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
336 |
|
33a2c446e6dc
add needed configure magic and header includes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
164
diff
changeset
|
337 |
|
164
ec0f3aa7f047
import cairo code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
338 |
#endif /* CAIRO_WIDEINT_H */ |