~ubuntu-branches/ubuntu/karmic/moon/karmic

« back to all changes in this revision

Viewing changes to cairo/src/cairo-wideint-type-private.h

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-14 12:01:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090214120108-06539vb25vhbd8bn
Tags: upstream-1.0
Import upstream version 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 <keithp@keithp.com>
 
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 <stdint.h>
 
48
#elif HAVE_INTTYPES_H
 
49
# include <inttypes.h>
 
50
#elif HAVE_SYS_INT_TYPES_H
 
51
# include <sys/int_types.h>
 
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
 
83
 
 
84
#if HAVE_BYTESWAP_H
 
85
# include <byteswap.h>
 
86
#endif
 
87
#ifndef bswap_16
 
88
# define bswap_16(p) \
 
89
        (((((uint16_t)(p)) & 0x00ff) << 8) | \
 
90
          (((uint16_t)(p))           >> 8));
 
91
#endif
 
92
#ifndef bswap_32
 
93
# define bswap_32(p) \
 
94
         (((((uint32_t)(p)) & 0x000000ff) << 24) | \
 
95
          ((((uint32_t)(p)) & 0x0000ff00) << 8)  | \
 
96
          ((((uint32_t)(p)) & 0x00ff0000) >> 8)  | \
 
97
          ((((uint32_t)(p)))              >> 24));
 
98
#endif
 
99
 
 
100
 
 
101
#if !HAVE_UINT64_T
 
102
 
 
103
typedef struct _cairo_uint64 {
 
104
    uint32_t    lo, hi;
 
105
} cairo_uint64_t, cairo_int64_t;
 
106
 
 
107
#else
 
108
 
 
109
typedef uint64_t    cairo_uint64_t;
 
110
typedef int64_t     cairo_int64_t;
 
111
 
 
112
#endif
 
113
 
 
114
typedef struct _cairo_uquorem64 {
 
115
    cairo_uint64_t      quo;
 
116
    cairo_uint64_t      rem;
 
117
} cairo_uquorem64_t;
 
118
 
 
119
typedef struct _cairo_quorem64 {
 
120
    cairo_int64_t       quo;
 
121
    cairo_int64_t       rem;
 
122
} cairo_quorem64_t;
 
123
 
 
124
 
 
125
#if !HAVE_UINT128_T
 
126
 
 
127
typedef struct cairo_uint128 {
 
128
    cairo_uint64_t      lo, hi;
 
129
} cairo_uint128_t, cairo_int128_t;
 
130
 
 
131
#else
 
132
 
 
133
typedef uint128_t       cairo_uint128_t;
 
134
typedef int128_t        cairo_int128_t;
 
135
 
 
136
#endif
 
137
 
 
138
typedef struct _cairo_uquorem128 {
 
139
    cairo_uint128_t     quo;
 
140
    cairo_uint128_t     rem;
 
141
} cairo_uquorem128_t;
 
142
 
 
143
typedef struct _cairo_quorem128 {
 
144
    cairo_int128_t      quo;
 
145
    cairo_int128_t      rem;
 
146
} cairo_quorem128_t;
 
147
 
 
148
 
 
149
#endif /* CAIRO_WIDEINT_H */