Dave Chapman | de3d58c | 2005-02-15 19:45:38 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2005 by Dave Chapman |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * 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. |
Dave Chapman | de3d58c | 2005-02-15 19:45:38 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 21 | |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 22 | #ifndef __STDINT_H__ |
| 23 | #define __STDINT_H__ |
Frank Gevaerts | 5d22e3c | 2008-08-29 21:08:38 +0000 | [diff] [blame] | 24 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 25 | #include <limits.h> |
Dave Chapman | de3d58c | 2005-02-15 19:45:38 +0000 | [diff] [blame] | 26 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 27 | /* 8 bit */ |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 28 | #define INT8_MIN SCHAR_MIN |
| 29 | #define INT8_MAX SCHAR_MAX |
| 30 | #define UINT8_MAX UCHAR_MAX |
| 31 | #define int8_t signed char |
| 32 | #define uint8_t unsigned char |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 33 | |
| 34 | /* 16 bit */ |
| 35 | #if USHRT_MAX == 0xffff |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 36 | |
| 37 | #define INT16_MIN SHRT_MIN |
| 38 | #define INT16_MAX SHRT_MAX |
| 39 | #define UINT16_MAX USHRT_MAX |
| 40 | #define int16_t short |
| 41 | #define uint16_t unsigned short |
| 42 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | /* 32 bit */ |
| 46 | #if ULONG_MAX == 0xfffffffful |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 47 | |
| 48 | #define INT32_MIN LONG_MIN |
| 49 | #define INT32_MAX LONG_MAX |
| 50 | #define UINT32_MAX ULONG_MAX |
| 51 | #define int32_t long |
| 52 | #define uint32_t unsigned long |
| 53 | |
| 54 | #define INTPTR_MIN LONG_MIN |
| 55 | #define INTPTR_MAX LONG_MAX |
| 56 | #define UINTPTR_MAX ULONG_MAX |
| 57 | #define intptr_t long |
| 58 | #define uintptr_t unsigned long |
| 59 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 60 | #elif UINT_MAX == 0xffffffffu |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 61 | |
| 62 | #define INT32_MIN INT_MIN |
| 63 | #define INT32_MAX INT_MAX |
| 64 | #define UINT32_MAX UINT_MAX |
| 65 | #define int32_t int |
| 66 | #define uint32_t unsigned int |
| 67 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 68 | #endif |
| 69 | |
| 70 | /* 64 bit */ |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 71 | #ifndef LLONG_MIN |
| 72 | #define LLONG_MIN ((long long)9223372036854775808ull) |
| 73 | #endif |
| 74 | |
| 75 | #ifndef LLONG_MAX |
| 76 | #define LLONG_MAX 9223372036854775807ll |
| 77 | #endif |
| 78 | |
| 79 | #ifndef ULLONG_MAX |
| 80 | #define ULLONG_MAX 18446744073709551615ull |
| 81 | #endif |
| 82 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 83 | #if ULONG_MAX == 0xffffffffffffffffull |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 84 | |
| 85 | #define INT64_MIN LONG_MIN |
| 86 | #define INT64_MAX LONG_MAX |
| 87 | #define UINT64_MAX ULONG_MAX |
| 88 | #define int64_t long |
| 89 | #define uint64_t unsigned long |
| 90 | |
| 91 | #define INTPTR_MIN LONG_MIN |
| 92 | #define INTPTR_MAX LONG_MAX |
| 93 | #define UINTPTR_MAX ULONG_MAX |
| 94 | #define intptr_t long |
| 95 | #define uintptr_t unsigned long |
| 96 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 97 | #else |
Michael Sevakis | af7780e | 2007-04-10 09:43:06 +0000 | [diff] [blame] | 98 | |
| 99 | #define INT64_MIN LLONG_MIN |
| 100 | #define INT64_MAX LLONG_MAX |
| 101 | #define UINT64_MAX ULLONG_MAX |
| 102 | #define int64_t long long |
| 103 | #define uint64_t unsigned long long |
| 104 | |
Jens Arnold | fb7368e | 2006-03-03 01:12:50 +0000 | [diff] [blame] | 105 | #endif |
Dave Chapman | de3d58c | 2005-02-15 19:45:38 +0000 | [diff] [blame] | 106 | |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 107 | #endif /* __STDINT_H__ */ |