1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2004 Keith Packard
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.
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
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/
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.
28 * The Original Code is the cairo graphics library.
30 * The Initial Developer of the Original Code is Keith Packard
33 * Keith R. Packard <keithp@keithp.com>
37 #ifndef CAIRO_WIDEINT_TYPE_H
38 #define CAIRO_WIDEINT_TYPE_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
65 #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
69 # define INT16_MIN (-32767-1)
72 # define INT16_MAX (32767)
75 # define UINT16_MAX (65535)
78 # define INT32_MIN (-2147483647-1)
81 # define INT32_MAX (2147483647)
85 # include <byteswap.h>
88 # define bswap_16(p) \
89 (((((uint16_t)(p)) & 0x00ff) << 8) | \
90 (((uint16_t)(p)) >> 8));
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));
103 typedef struct _cairo_uint64
{
105 } cairo_uint64_t
, cairo_int64_t
;
109 typedef uint64_t cairo_uint64_t
;
110 typedef int64_t cairo_int64_t
;
114 typedef struct _cairo_uquorem64
{
119 typedef struct _cairo_quorem64
{
127 typedef struct cairo_uint128
{
128 cairo_uint64_t lo
, hi
;
129 } cairo_uint128_t
, cairo_int128_t
;
133 typedef uint128_t cairo_uint128_t
;
134 typedef int128_t cairo_int128_t
;
138 typedef struct _cairo_uquorem128
{
141 } cairo_uquorem128_t
;
143 typedef struct _cairo_quorem128
{
149 #endif /* CAIRO_WIDEINT_H */