2 * This file is part of DisOrder.
3 * Copyright (C) 2004, 2005, 2007, 2008, 2013 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
30 # include <inttypes.h>
33 #include <sys/types.h>
35 /* had better be before atol/atoll redefinition */
42 typedef long long long_long;
43 typedef unsigned long long u_long_long;
44 # if ! DECLARES_STRTOLL
45 long long strtoll(const char *, char **, int);
48 long long atoll(const char *);
51 typedef long long_long;
52 typedef unsigned long u_long_long;
54 # define strtoll strtol
58 /* apple define these to j[dxu], which gcc -std=c99 -pedantic then rejects */
69 typedef long long intmax_t;
70 # define PRIdMAX "lld"
72 typedef long intmax_t;
84 typedef unsigned long long uintmax_t;
85 # define PRIuMAX "llu"
86 # define PRIxMAX "llx"
88 typedef unsigned long uintmax_t;
95 typedef unsigned char uint8_t;
97 # error cannot determine uint8_t
102 # if UINT_MAX == 4294967295
103 typedef unsigned int uint32_t;
104 # elif ULONG_MAX == 4294967295
105 typedef unsigned long uint32_t;
106 # elif USHRT_MAX == 4294967295
107 typedef unsigned short uint32_t;
108 # elif UCHAR_MAX == 4294967295
109 typedef unsigned char uint32_t;
111 # error cannot determine uint32_t
115 #endif /* COMMENT_H */