Subversion Repositories Kolibri OS

Rev

Rev 1892 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1892 serge 1
/* cairo - a vector graphics library with display and print output
2
 *
3
 * Copyright © 2004 Keith Packard
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it either under the terms of the GNU Lesser General Public
7
 * License version 2.1 as published by the Free Software Foundation
8
 * (the "LGPL") or, at your option, under the terms of the Mozilla
9
 * Public License Version 1.1 (the "MPL"). If you do not alter this
10
 * notice, a recipient may use your version of this file under either
11
 * the MPL or the LGPL.
12
 *
13
 * You should have received a copy of the LGPL along with this library
14
 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
15
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
16
 * You should have received a copy of the MPL along with this library
17
 * in the file COPYING-MPL-1.1
18
 *
19
 * The contents of this file are subject to the Mozilla Public License
20
 * Version 1.1 (the "License"); you may not use this file except in
21
 * compliance with the License. You may obtain a copy of the License at
22
 * http://www.mozilla.org/MPL/
23
 *
24
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25
 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
26
 * the specific language governing rights and limitations.
27
 *
28
 * The Original Code is the cairo graphics library.
29
 *
30
 * The Initial Developer of the Original Code is Keith Packard
31
 *
32
 * Contributor(s):
33
 *	Keith R. Packard 
34
 *
35
 */
36
 
37
#ifndef CAIRO_WIDEINT_TYPE_H
38
#define CAIRO_WIDEINT_TYPE_H
39
 
40
#include "cairo.h"
41
 
42
#if HAVE_CONFIG_H
43
#include "config.h"
44
#endif
45
 
46
#if   HAVE_STDINT_H
47
# include 
48
#elif HAVE_INTTYPES_H
49
# include 
50
#elif HAVE_SYS_INT_TYPES_H
51
# include 
52
#elif defined(_MSC_VER)
53
  typedef __int8 int8_t;
54
  typedef unsigned __int8 uint8_t;
55
  typedef __int16 int16_t;
56
  typedef unsigned __int16 uint16_t;
57
  typedef __int32 int32_t;
58
  typedef unsigned __int32 uint32_t;
59
  typedef __int64 int64_t;
60
  typedef unsigned __int64 uint64_t;
61
# ifndef HAVE_UINT64_T
62
#  define HAVE_UINT64_T 1
63
# endif
64
#else
65
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
66
#endif
67
 
68
#ifndef INT16_MIN
69
# define INT16_MIN	(-32767-1)
70
#endif
71
#ifndef INT16_MAX
72
# define INT16_MAX	(32767)
73
#endif
74
#ifndef UINT16_MAX
75
# define UINT16_MAX	(65535)
76
#endif
77
#ifndef INT32_MIN
78
# define INT32_MIN	(-2147483647-1)
79
#endif
80
#ifndef INT32_MAX
81
# define INT32_MAX	(2147483647)
82
#endif
3959 Serge 83
#ifndef UINT32_MAX
84
# define UINT32_MAX     (4294967295U)
85
#endif
1892 serge 86
 
87
#if HAVE_BYTESWAP_H
88
# include 
89
#endif
90
#ifndef bswap_16
91
# define bswap_16(p) \
92
	(((((uint16_t)(p)) & 0x00ff) << 8) | \
93
	  (((uint16_t)(p))           >> 8));
94
#endif
95
#ifndef bswap_32
96
# define bswap_32(p) \
97
         (((((uint32_t)(p)) & 0x000000ff) << 24) | \
98
	  ((((uint32_t)(p)) & 0x0000ff00) << 8)  | \
99
	  ((((uint32_t)(p)) & 0x00ff0000) >> 8)  | \
100
	  ((((uint32_t)(p)))              >> 24));
101
#endif
102
 
103
 
104
#if !HAVE_UINT64_T
105
 
106
typedef struct _cairo_uint64 {
3959 Serge 107
   uint32_t   lo, hi;
108
/ cairo_uint64_t, cairo_int64_t;
1892 serge 109
 
110
#else
111
 
112
typedef uint64_t    cairo_uint64_t;
3959 Serge 113
typedef int64_t     cairo_int64_t;
1892 serge 114
 
115
#endif
116
 
117
typedef struct _cairo_uquorem64 {
118
    cairo_uint64_t	quo;
119
    cairo_uint64_t	rem;
120
} cairo_uquorem64_t;
121
 
122
typedef struct _cairo_quorem64 {
123
    cairo_int64_t	quo;
124
    cairo_int64_t	rem;
125
} cairo_quorem64_t;
126
 
127
/* gcc has a non-standard name. */
128
#if HAVE___UINT128_T && !HAVE_UINT128_T
129
typedef __uint128_t uint128_t;
130
typedef __int128_t int128_t;
131
#define HAVE_UINT128_T 1
132
#endif
133
 
134
#if !HAVE_UINT128_T
135
 
136
typedef struct cairo_uint128 {
137
    cairo_uint64_t	lo, hi;
138
} cairo_uint128_t, cairo_int128_t;
139
 
140
#else
141
 
142
typedef uint128_t	cairo_uint128_t;
143
typedef int128_t	cairo_int128_t;
144
 
145
#endif
146
 
147
typedef struct _cairo_uquorem128 {
148
    cairo_uint128_t	quo;
149
    cairo_uint128_t	rem;
150
} cairo_uquorem128_t;
151
 
152
typedef struct _cairo_quorem128 {
153
    cairo_int128_t	quo;
154
    cairo_int128_t	rem;
155
} cairo_quorem128_t;
156
 
157
 
158
#endif /* CAIRO_WIDEINT_H */