Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

bittypes.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1999 WIDE Project.
00003  * All rights reserved.
00004  * 
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the project nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  */
00029 #ifndef _BITTYPES_H
00030 #define _BITTYPES_H
00031 
00032 #ifndef HAVE_U_INT8_T
00033 
00034 #if SIZEOF_CHAR == 1
00035 typedef unsigned char u_int8_t;
00036 typedef signed char int8_t;
00037 #elif SIZEOF_INT == 1
00038 typedef unsigned int u_int8_t;
00039 typedef signed int int8_t;
00040 #else  /* XXX */
00041 #error "there's no appropriate type for u_int8_t"
00042 #endif
00043 #define HAVE_U_INT8_T 1
00044 #define HAVE_INT8_T 1
00045 
00046 #endif /* HAVE_U_INT8_T */
00047 
00048 #ifndef HAVE_U_INT16_T 
00049 
00050 #if SIZEOF_SHORT == 2
00051 typedef unsigned short u_int16_t;
00052 typedef signed short int16_t;
00053 #elif SIZEOF_INT == 2
00054 typedef unsigned int u_int16_t;
00055 typedef signed int int16_t;
00056 #elif SIZEOF_CHAR == 2
00057 typedef unsigned char u_int16_t;
00058 typedef signed char int16_t;
00059 #else  /* XXX */
00060 #error "there's no appropriate type for u_int16_t"
00061 #endif
00062 #define HAVE_U_INT16_T 1
00063 #define HAVE_INT16_T 1
00064 
00065 #endif /* HAVE_U_INT16_T */
00066 
00067 #ifndef HAVE_U_INT32_T
00068 
00069 #if SIZEOF_INT == 4
00070 typedef unsigned int u_int32_t;
00071 typedef signed int int32_t;
00072 #elif SIZEOF_LONG == 4
00073 typedef unsigned long u_int32_t;
00074 typedef signed long int32_t;
00075 #elif SIZEOF_SHORT == 4
00076 typedef unsigned short u_int32_t;
00077 typedef signed short int32_t;
00078 #else  /* XXX */
00079 #error "there's no appropriate type for u_int32_t"
00080 #endif
00081 #define HAVE_U_INT32_T 1
00082 #define HAVE_INT32_T 1
00083 
00084 #endif /* HAVE_U_INT32_T */
00085 
00086 #ifndef HAVE_U_INT64_T
00087 #if SIZEOF_LONG_LONG == 8
00088 typedef unsigned long long u_int64_t;
00089 #elif defined(_MSC_EXTENSIONS)
00090 typedef unsigned _int64 u_int64_t;
00091 #elif SIZEOF_INT == 8
00092 typedef unsigned int u_int64_t;
00093 #elif SIZEOF_LONG == 8
00094 typedef unsigned long u_int64_t;
00095 #elif SIZEOF_SHORT == 8
00096 typedef unsigned short u_int64_t;
00097 #else  /* XXX */
00098 #error "there's no appropriate type for u_int64_t"
00099 #endif
00100 
00101 #endif /* HAVE_U_INT64_T */
00102 
00103 #ifndef PRId64
00104 #ifdef _MSC_EXTENSIONS
00105 #define PRId64  "I64d"
00106 #else /* _MSC_EXTENSIONS */
00107 #define PRId64  "lld"
00108 #endif /* _MSC_EXTENSIONS */
00109 #endif /* PRId64 */
00110 
00111 #ifndef PRIo64
00112 #ifdef _MSC_EXTENSIONS
00113 #define PRIo64  "I64o"
00114 #else /* _MSC_EXTENSIONS */
00115 #define PRIo64  "llo"
00116 #endif /* _MSC_EXTENSIONS */
00117 #endif /* PRIo64 */
00118 
00119 #ifndef PRIx64
00120 #ifdef _MSC_EXTENSIONS
00121 #define PRIx64  "I64x"
00122 #else /* _MSC_EXTENSIONS */
00123 #define PRIx64  "llx"
00124 #endif /* _MSC_EXTENSIONS */
00125 #endif /* PRIx64 */
00126 
00127 #ifndef PRIu64
00128 #ifdef _MSC_EXTENSIONS
00129 #define PRIu64  "I64u"
00130 #else /* _MSC_EXTENSIONS */
00131 #define PRIu64  "llu"
00132 #endif /* _MSC_EXTENSIONS */
00133 #endif /* PRIu64 */
00134 
00135 #endif /* _BITTYPES_H */

Generated on Sun May 14 14:51:20 2006 by  doxygen 1.4.2