1 /* 2 * $Id: stdint-hwbench.h,v 1.2 2005/07/15 07:50:16 telka Exp $ 3 * 4 * stdint.h - integer types for Hitachi Workbench/IAR Compiler 5 * Copyright (C) 2005 Elcom s.r.o. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the copyright holders nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 * Written by Marcel Telka <marcel@telka.sk>, 2005. 32 * 33 */ 34 35 #ifndef STDINT_H 36 #define STDINT_H 37 38 #include <limits.h> 39 40 /* 41 * Integer Types 42 */ 43 44 /* Exact-width integer types */ 45 46 typedef signed char int8_t; 47 typedef short int16_t; 48 typedef long int32_t; 49 typedef unsigned char uint8_t; 50 typedef unsigned short uint16_t; 51 typedef unsigned long uint32_t; 52 53 /* Minimum-width integer types */ 54 55 typedef signed char int_least8_t; 56 typedef short int_least16_t; 57 typedef long int_least32_t; 58 /* int_least64_t not supported */ 59 typedef unsigned char uint_least8_t; 60 typedef unsigned short uint_least16_t; 61 typedef unsigned long uint_least32_t; 62 /* uint_least64_t not supported */ 63 64 /* Fastest minimum-width integer types */ 65 66 typedef signed char int_fast8_t; 67 typedef short int_fast16_t; 68 typedef long int_fast32_t; 69 /* int_fast64_t not supported */ 70 typedef unsigned char uint_fast8_t; 71 typedef unsigned short uint_fast16_t; 72 typedef unsigned long uint_fast32_t; 73 /* uint_least64_t not supported */ 74 75 /* Integer types capable of holding object pointers */ 76 77 typedef long intptr_t; 78 typedef unsigned long uintptr_t; 79 80 /* Greatest-width integer types */ 81 82 typedef long intmax_t; 83 typedef unsigned long uintmax_t; 84 85 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) 86 87 /* 88 * Limits of Specified-Width Interger Types 89 */ 90 91 /* Limits of exact-width integer types */ 92 93 #define INT8_MIN (-127 - 1) 94 #define INT16_MIN (-32767 - 1) 95 #define INT32_MIN (-2147483647 - 1) 96 97 #define INT8_MAX 127 98 #define INT16_MAX 32767 99 #define INT32_MAX 2147483647 100 101 #define UINT8_MAX 0xFF 102 #define UINT16_MAX 0xFFFF 103 #define UINT32_MAX 0xFFFFFFFF 104 105 /* Limits of minimum-width integer types */ 106 107 #define INT_LEAST8_MIN INT8_MIN 108 #define INT_LEAST16_MIN INT16_MIN 109 #define INT_LEAST32_MIN INT32_MIN 110 111 #define INT_LEAST8_MAX INT8_MAX 112 #define INT_LEAST16_MAX INT16_MAX 113 #define INT_LEAST32_MAX INT32_MAX 114 115 #define UINT_LEAST8_MAX UINT8_MAX 116 #define UINT_LEAST16_MAX UINT16_MAX 117 #define UINT_LEAST32_MAX UINT32_MAX 118 119 /* Limits of fastest minimum-width integer types */ 120 121 #define INT_FAST8_MIN INT8_MIN 122 #define INT_FAST16_MIN INT16_MIN 123 #define INT_FAST32_MIN INT32_MIN 124 125 #define INT_FAST8_MAX INT8_MAX 126 #define INT_FAST16_MAX INT16_MAX 127 #define INT_FAST32_MAX INT32_MAX 128 129 #define UINT_FAST8_MAX UINT8_MAX 130 #define UINT_FAST16_MAX UINT16_MAX 131 #define UINT_FAST32_MAX UINT32_MAX 132 133 /* Limits of integer types capable of holding object pointers */ 134 135 #define INTPTR_MIN INT32_MIN 136 #define INTPTR_MAX INT32_MAX 137 #define UINTPTR_MAX UINT32_MAX 138 139 /* Limits of greatest-width integer types */ 140 141 #define INTMAX_MIN INT32_MIN 142 #define INTMAX_MAX INT32_MAX 143 #define UINTMAX_MAX UINT32_MAX 144 145 /* 146 * Limits of Other Integer Types 147 */ 148 149 /* Limits of ptrdiff_t */ 150 151 #define PTRDIFF_MIN INT32_MIN 152 #define PTRDIFF_MAX UINT32_MAX 153 154 /* Limits of sig_atomic_t */ 155 156 /* N/A for Hitachi Workbench/IAR Compiler */ 157 158 /* Limit of size_t */ 159 160 #define SIZE_MAX UINT32_MAX 161 162 /* Limits of wchar_t */ 163 164 #define WCHAR_MIN CHAR_MIN 165 #define WCHAR_MAX CHAR_MAX 166 167 /* Limits of wint_t */ 168 169 /* wint_t not supported in Hitachi Workbench/IAR Compiler */ 170 171 #endif /* __STDC_LIMIT_MACROS */ 172 173 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) 174 175 /* 176 * Macros for Integer Constant Expressions 177 */ 178 179 /* Macros for minimum-width integer constant expressions */ 180 181 #define INT8_C(value) (value) 182 #define INT16_C(value) (value) 183 #define INT32_C(value) (value) 184 185 #define UINT8_C(value) (value) 186 #define UINT16_C(value) (value) 187 #define UINT32_C(value) (value) 188 189 /* Macros for greatest-width integer constant expressions */ 190 191 #define INTMAX_C(value) INT32_C(value) 192 #define UINTMAX_C(value) UINT32_C(value) 193 194 #endif /* __STDC_CONSTANT_MACROS */ 195 196 #endif /* STDINT_H */ 197