summaryrefslogtreecommitdiffstats
path: root/src/kvilib/core/kvi_inttypes.h
blob: 6405ee79c2cf5cbbf67459ae3d37aee743efa12e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef _KVI_INTTYPES_H_
#define _KVI_INTTYPES_H_
//=============================================================================
//
//   File : kvi_inttypes.h
//   Creation date : Wed Sep  4 22:28:00 2002 GMT by Szymon Stefanek
//
//   This file is part of the KVirc irc client distribution
//   Copyright (C) 2002-2006 Szymon Stefanek (pragma at kvirc dot net)
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "kvi_settings.h"

#ifdef COMPILE_ON_WINDOWS
	// we don't have a configure script here
	// so we can't check the size of types
	// We rely on the ms specific definitions then
	typedef __int64 kvi_i64_t;
	typedef unsigned __int64 kvi_u64_t;
	typedef int kvi_i32_t;
	typedef unsigned int kvi_u32_t;
	typedef short int kvi_i16_t;
	typedef short unsigned int kvi_u16_t;
	typedef char kvi_i8_t;
	typedef unsigned char kvi_u8_t;
#else
	#if SIZEOF_LONG_INT == 8
		// the most common case on 64 bit machines
		typedef long int kvi_i64_t;
		typedef unsigned long int kvi_u64_t;
	#elif SIZEOF_INT == 8
		// 64 bit ints ?.. a Cray ? :D
		typedef int kvi_i64_t;
		typedef unsigned int kvi_u64_t;
	#elif SIZEOF_LONG_LONG_INT == 8
		// the most common case on 32 bit machines
		typedef long long int kvi_i64_t;
		typedef unsigned long long int kvi_u64_t;
	#else
		// attempt to live without a 64bit integer type anyway...
		// dunno if it will work tough...
		typedef long long int kvi_i64_t;
		typedef unsigned long long int kvi_u64_t;
	#endif

	#if SIZEOF_INT == 4
		// the most common case
		typedef int kvi_i32_t;
		typedef unsigned int kvi_u32_t;
	#elif SIZEOF_SHORT_INT == 4
		// 32 bit shorts ?.. a Cray ? :D
		typedef short int kvi_i32_t;
		typedef short unsigned int kvi_u32_t;
	#elif SIZEOF_LONG_INT == 4
		typedef long int kvi_i32_t;
		typedef unsigned long int kvi_u32_t;
	#else
		#error "Can't find a 32 bit integral type on this system"
		#error "Please report to pragma at kvirc dot net"
	#endif

	#if SIZEOF_SHORT_INT == 2
		// the most common case
		typedef short int kvi_i16_t;
		typedef short unsigned int kvi_u16_t;
	#elif SIZEOF_INT == 2
		// this isn't going to work anyway, I think..
		typedef int kvi_i16_t;
		typedef long int kvi_u16_t;
	#else
		#error "Can't find a 16 bit integral type on this system"
		#error "Please report to pragma at kvirc dot net"
	#endif

	// assume that char is always 8 bit
	typedef char kvi_i8_t;
	typedef unsigned char kvi_u8_t;
#endif

#endif //_KVI_INTTYPES_H_