summaryrefslogtreecommitdiff
path: root/src/common/torint.h
blob: 65984b5190a5910f97c7b9080732b0227bb7a6b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Copyright 2003 Roger Dingledine */
/* See LICENSE for licensing information */
/* $Id$ */

#ifndef __TORINT_H
#define __TORINT_H

#ifdef HAVE_STDINT_H
#include <stdint.h>
#else

#if (SIZEOF_CHAR == 1)
typedef unsigned char uint8_t;
typedef signed char int8_t;
#else
#error "sizeof(char) != 1"
#endif

#if (SIZEOF_SHORT == 2)
typedef unsigned short uint16_t;
typedef signed short int16_t;
#elif (SIZEOF_INT == 2)
typedef unsigned int uint16_t;
typedef signed int int16_t;
#else
#error "sizeof(short) != 2 && sizeof(int) != 2"
#endif

#if (SIZEOF_INT == 4)
typedef unsigned int uint32_t;
typedef signed int int32_t;
#elif (SIZEOF_LONG == 4)
typedef unsigned long uint32_t;
typedef signed long int32_t;
#else
#error "sizeof(int) != 4 && sizeof(long) != 4"
#endif

#if (SIZEOF_LONG == 8)
typedef unsigned long uint64_t;
typedef signed long int64_t;
#elif (SIZEOF_LONG_LONG == 8)
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
#elif (SIZEOF___INT64 == 8)
typedef unsigned __int64 uint64_t;
typedef signed __int64 int64_t;
#else
#error "sizeof(long) != 8 && sizeof(long long) != 8 && sizeof(__int64) != 8"
#endif

#endif /* HAVE_STDINT_H */


#endif /* __TORINT_H */