os/boardsupport/emulator/emulatorbsp/wpdpack/include/bittypes.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
 * Copyright (C) 1999 WIDE Project.
sl@0
     3
 * All rights reserved.
sl@0
     4
 * 
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 3. Neither the name of the project nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 * 
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 */
sl@0
    29
#ifndef _BITTYPES_H
sl@0
    30
#define _BITTYPES_H
sl@0
    31
sl@0
    32
#ifndef HAVE_U_INT8_T
sl@0
    33
sl@0
    34
#if SIZEOF_CHAR == 1
sl@0
    35
typedef unsigned char u_int8_t;
sl@0
    36
typedef signed char int8_t;
sl@0
    37
#elif SIZEOF_INT == 1
sl@0
    38
typedef unsigned int u_int8_t;
sl@0
    39
typedef signed int int8_t;
sl@0
    40
#else  /* XXX */
sl@0
    41
#error "there's no appropriate type for u_int8_t"
sl@0
    42
#endif
sl@0
    43
#define HAVE_U_INT8_T 1
sl@0
    44
#define HAVE_INT8_T 1
sl@0
    45
sl@0
    46
#endif /* HAVE_U_INT8_T */
sl@0
    47
sl@0
    48
#ifndef HAVE_U_INT16_T 
sl@0
    49
sl@0
    50
#if SIZEOF_SHORT == 2
sl@0
    51
typedef unsigned short u_int16_t;
sl@0
    52
typedef signed short int16_t;
sl@0
    53
#elif SIZEOF_INT == 2
sl@0
    54
typedef unsigned int u_int16_t;
sl@0
    55
typedef signed int int16_t;
sl@0
    56
#elif SIZEOF_CHAR == 2
sl@0
    57
typedef unsigned char u_int16_t;
sl@0
    58
typedef signed char int16_t;
sl@0
    59
#else  /* XXX */
sl@0
    60
#error "there's no appropriate type for u_int16_t"
sl@0
    61
#endif
sl@0
    62
#define HAVE_U_INT16_T 1
sl@0
    63
#define HAVE_INT16_T 1
sl@0
    64
sl@0
    65
#endif /* HAVE_U_INT16_T */
sl@0
    66
sl@0
    67
#ifndef HAVE_U_INT32_T
sl@0
    68
sl@0
    69
#if SIZEOF_INT == 4
sl@0
    70
typedef unsigned int u_int32_t;
sl@0
    71
typedef signed int int32_t;
sl@0
    72
#elif SIZEOF_LONG == 4
sl@0
    73
typedef unsigned long u_int32_t;
sl@0
    74
typedef signed long int32_t;
sl@0
    75
#elif SIZEOF_SHORT == 4
sl@0
    76
typedef unsigned short u_int32_t;
sl@0
    77
typedef signed short int32_t;
sl@0
    78
#else  /* XXX */
sl@0
    79
#error "there's no appropriate type for u_int32_t"
sl@0
    80
#endif
sl@0
    81
#define HAVE_U_INT32_T 1
sl@0
    82
#define HAVE_INT32_T 1
sl@0
    83
sl@0
    84
#endif /* HAVE_U_INT32_T */
sl@0
    85
sl@0
    86
#ifndef HAVE_U_INT64_T
sl@0
    87
#if SIZEOF_LONG_LONG == 8
sl@0
    88
typedef unsigned long long u_int64_t;
sl@0
    89
#elif defined(_MSC_EXTENSIONS)
sl@0
    90
typedef unsigned _int64 u_int64_t;
sl@0
    91
#elif SIZEOF_INT == 8
sl@0
    92
typedef unsigned int u_int64_t;
sl@0
    93
#elif SIZEOF_LONG == 8
sl@0
    94
typedef unsigned long u_int64_t;
sl@0
    95
#elif SIZEOF_SHORT == 8
sl@0
    96
typedef unsigned short u_int64_t;
sl@0
    97
#else  /* XXX */
sl@0
    98
#error "there's no appropriate type for u_int64_t"
sl@0
    99
#endif
sl@0
   100
sl@0
   101
#endif /* HAVE_U_INT64_T */
sl@0
   102
sl@0
   103
#ifndef PRId64
sl@0
   104
#ifdef _MSC_EXTENSIONS
sl@0
   105
#define PRId64	"I64d"
sl@0
   106
#else /* _MSC_EXTENSIONS */
sl@0
   107
#define PRId64	"lld"
sl@0
   108
#endif /* _MSC_EXTENSIONS */
sl@0
   109
#endif /* PRId64 */
sl@0
   110
sl@0
   111
#ifndef PRIo64
sl@0
   112
#ifdef _MSC_EXTENSIONS
sl@0
   113
#define PRIo64	"I64o"
sl@0
   114
#else /* _MSC_EXTENSIONS */
sl@0
   115
#define PRIo64	"llo"
sl@0
   116
#endif /* _MSC_EXTENSIONS */
sl@0
   117
#endif /* PRIo64 */
sl@0
   118
sl@0
   119
#ifndef PRIx64
sl@0
   120
#ifdef _MSC_EXTENSIONS
sl@0
   121
#define PRIx64	"I64x"
sl@0
   122
#else /* _MSC_EXTENSIONS */
sl@0
   123
#define PRIx64	"llx"
sl@0
   124
#endif /* _MSC_EXTENSIONS */
sl@0
   125
#endif /* PRIx64 */
sl@0
   126
sl@0
   127
#ifndef PRIu64
sl@0
   128
#ifdef _MSC_EXTENSIONS
sl@0
   129
#define PRIu64	"I64u"
sl@0
   130
#else /* _MSC_EXTENSIONS */
sl@0
   131
#define PRIu64	"llu"
sl@0
   132
#endif /* _MSC_EXTENSIONS */
sl@0
   133
#endif /* PRIu64 */
sl@0
   134
sl@0
   135
#endif /* _BITTYPES_H */