1 /* (C) Copyright 2001, 2002, 2003, 2004, 2005 Stijn van Dongen 2 * (C) Copyright 2006, 2007, 2008, 2009 Stijn van Dongen 3 * 4 * This file is part of tingea. You can redistribute and/or modify tingea 5 * under the terms of the GNU General Public License; either version 3 of the 6 * License or (at your option) any later version. You should have received a 7 * copy of the GPL along with tingea, in the file COPYING. 8 */ 9 10 #ifndef tingea_inttypes_h 11 #define tingea_inttypes_h 12 13 #include <limits.h> 14 #include <sys/types.h> 15 16 17 #if UINT_MAX >= 4294967295 18 # define MCX_UINT32 unsigned int 19 # define MCX_INT32 int 20 #else 21 # define MCX_UINT32 unsigned long 22 # define MCX_INT32 long 23 #endif 24 25 typedef MCX_UINT32 u32 ; /* at least 32 bits */ 26 typedef MCX_INT32 i32 ; /* at least 32 bits */ 27 typedef unsigned char u8 ; /* at least 8 bits */ 28 29 #ifndef ulong 30 # define ulong unsigned long 31 #endif 32 33 #ifndef uchar 34 # define uchar unsigned char 35 #endif 36 37 /* dim is garantueed to be an unsigned type. 38 * ofs is garantueed to be the corresponding signed type. 39 */ 40 #if 0 41 # define dim size_t 42 # define ofs ssize_t 43 #else 44 typedef size_t dim; 45 typedef ssize_t ofs; 46 #endif 47 48 #ifdef SIZE_MAX 49 # define DIM_MAX SIZE_MAX 50 #else 51 # define DIM_MAX ((size_t)-1) 52 #endif 53 54 #ifdef SSIZE_MAX 55 # define OFS_MAX SSIZE_MAX 56 #else 57 # define OFS_MAX LONG_MAX /* lame, reasonable stopgap */ 58 #endif 59 60 #ifdef SSIZE_MIN 61 # define OFS_MIN SSIZE_MIN 62 #else 63 # define OFS_MIN LONG_MIN /* lame, reasonable stopgap */ 64 #endif 65 66 67 /* annotate 'unsigned due to prototype' 68 * and related messages 69 */ 70 #define different_sign 71 #define different_width 72 73 74 #endif 75 76 77