2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 /** @file lib/common.h
19 * @brief Common includes and definitions
28 # include <inttypes.h>
31 #include <sys/types.h>
33 /* had better be before atol/atoll redefinition */
40 typedef long long long_long;
41 typedef unsigned long long u_long_long;
42 # if ! DECLARES_STRTOLL
43 long long strtoll(const char *, char **, int);
46 long long atoll(const char *);
49 typedef long long_long;
50 typedef unsigned long u_long_long;
52 # define strtoll strtol
56 /* apple define these to j[dxu], which gcc -std=c99 -pedantic then rejects */
67 typedef long long intmax_t;
68 # define PRIdMAX "lld"
70 typedef long intmax_t;
82 typedef unsigned long long uintmax_t;
83 # define PRIuMAX "llu"
84 # define PRIxMAX "llx"
86 typedef unsigned long uintmax_t;
93 typedef unsigned char uint8_t;
95 # error cannot determine uint8_t
100 # if UINT_MAX == 4294967295
101 typedef unsigned int uint32_t;
102 # elif ULONG_MAX == 4294967295
103 typedef unsigned long uint32_t;
104 # elif USHRT_MAX == 4294967295
105 typedef unsigned short uint32_t;
106 # elif UCHAR_MAX == 4294967295
107 typedef unsigned char uint32_t;
109 # error cannot determine uint32_t
113 #endif /* COMMENT_H */