blob: ddcaa988b1a04a1711bafc28071ad0a4e379915b [file] [log] [blame]
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
Thomas Martitz50a6ca32010-05-06 21:04:40 +000010 * Copyright (C) 2005 by Dave Chapman
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +000011 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
Thomas Martitz50a6ca32010-05-06 21:04:40 +000021
22#ifndef __INTTYPES_H__
23#define __INTTYPES_H__
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +000024
Thomas Martitz50a6ca32010-05-06 21:04:40 +000025#include <stdint.h>
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +000026
Rafaël Carréc0f9aa42010-05-30 16:00:03 +000027/* could possibly have (f)scanf format specifiers here */
28
29/* 8 bit */
30#define PRId8 "d"
31#define PRIi8 "d"
32#define PRIu8 "u"
33#define PRIx8 "x"
34#define PRIX8 "X"
35
36/* 16 bit */
37#if USHRT_MAX == 0xffff
38
39#define PRId16 "d"
40#define PRIi16 "d"
41#define PRIu16 "u"
42#define PRIx16 "x"
43#define PRIX16 "X"
44
45#endif
46
47/* 32 bit */
48#if ULONG_MAX == 0xfffffffful
49
50#define PRId32 "ld"
51#define PRIi32 "ld"
52#define PRIu32 "lu"
53#define PRIx32 "lx"
54#define PRIX32 "lX"
55#define PRIdPTR "ld"
56#define PRIiPTR "ld"
57#define PRIuPTR "lu"
58#define PRIxPTR "lx"
59#define PRIXPTR "lX"
60
61#elif UINT_MAX == 0xffffffffu
62
63#define PRId32 "d"
64#define PRIi32 "d"
65#define PRIu32 "u"
66#define PRIx32 "x"
67#define PRIX32 "X"
68
69#endif
70
71/* 64 bit */
72#if ULONG_MAX == 0xffffffffffffffffull
73
74#define PRId64 "ld"
75#define PRIi64 "ld"
76#define PRIu64 "lu"
77#define PRIx64 "lx"
78#define PRIX64 "lX"
79#define PRIdPTR "ld"
80#define PRIiPTR "ld"
81#define PRIuPTR "lu"
82#define PRIxPTR "lx"
83#define PRIXPTR "lX"
84
85
86#else
87
88#define PRId64 "lld"
89#define PRIi64 "lld"
90#define PRIu64 "llu"
91#define PRIx64 "llx"
92#define PRIX64 "llX"
Rafaël Carréc0f9aa42010-05-30 16:00:03 +000093
94#endif
Tomasz Malesinskie8e0b242006-01-25 01:35:04 +000095
Thomas Martitz50a6ca32010-05-06 21:04:40 +000096#endif /* __INTTYPES_H__ */