KVIrc  4.9.2
DeveloperAPIs
kvi_inttypes.h
Go to the documentation of this file.
1 #ifndef _KVI_INTTYPES_H_
2 #define _KVI_INTTYPES_H_
3 //=============================================================================
4 //
5 // File : kvi_inttypes.h
6 // Creation date : Wed Sep 4 22:28:00 2002 GMT by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 
29 // backward compatibility
30 #ifndef SYSTEM_SIZE_OF_SHORT_INT
31 #define SYSTEM_SIZE_OF_SHORT_INT SIZEOF_SHORT_INT
32 #define SYSTEM_SIZE_OF_INT SIZEOF_INT
33 #define SYSTEM_SIZE_OF_LONG_INT SIZEOF_LONG_INT
34 #define SYSTEM_SIZE_OF_LONG_LONG_INT SIZEOF_LONG_LONG_INT
35 #endif
36 
37 #ifdef COMPILE_ON_WINDOWS
38 // we don't have a configure script here
39 // so we can't check the size of types
40 // We rely on the ms specific definitions then
41 typedef __int64 kvi_i64_t;
42 typedef unsigned __int64 kvi_u64_t;
43 typedef int kvi_i32_t;
44 typedef unsigned int kvi_u32_t;
45 typedef short int kvi_i16_t;
46 typedef short unsigned int kvi_u16_t;
47 typedef char kvi_i8_t;
48 typedef unsigned char kvi_u8_t;
49 #else
50 #if SYSTEM_SIZE_OF_LONG_INT == 8
51 // the most common case on 64 bit machines
52 typedef long int kvi_i64_t;
53 typedef unsigned long int kvi_u64_t;
54 #elif SYSTEM_SIZE_OF_INT == 8
55 // 64 bit ints ?.. a Cray ? :D
56 typedef int kvi_i64_t;
57 typedef unsigned int kvi_u64_t;
58 #elif SYSTEM_SIZE_OF_LONG_LONG_INT == 8
59 // the most common case on 32 bit machines
60 typedef long long int kvi_i64_t;
61 typedef unsigned long long int kvi_u64_t;
62 #else
63 // attempt to live without a 64bit integer type anyway...
64 // dunno if it will work tough...
65 typedef long long int kvi_i64_t;
66 typedef unsigned long long int kvi_u64_t;
67 #endif
68 
69 #if SYSTEM_SIZE_OF_INT == 4
70 // the most common case
71 typedef int kvi_i32_t;
72 typedef unsigned int kvi_u32_t;
73 #elif SYSTEM_SIZE_OF_SHORT_INT == 4
74 // 32 bit shorts ?.. a Cray ? :D
75 typedef short int kvi_i32_t;
76 typedef short unsigned int kvi_u32_t;
77 #elif SYSTEM_SIZE_OF_LONG_INT == 4
78 typedef long int kvi_i32_t;
79 typedef unsigned long int kvi_u32_t;
80 #else
81 #error "Can't find a 32-bit integral type on this system"
82 #error "Please report to pragma at kvirc dot net"
83 #endif
84 
85 #if SYSTEM_SIZE_OF_SHORT_INT == 2
86 // the most common case
87 typedef short int kvi_i16_t;
88 typedef short unsigned int kvi_u16_t;
89 #elif SYSTEM_SIZE_OF_INT == 2
90 // this isn't going to work anyway, I think..
91 typedef int kvi_i16_t;
92 typedef long int kvi_u16_t;
93 #else
94 #error "Can't find a 16-bit integral type on this system"
95 #error "Please report to pragma at kvirc dot net"
96 #endif
97 
98 // assume that char is always 8 bit
99 typedef char kvi_i8_t;
100 typedef unsigned char kvi_u8_t;
101 #endif
102 
103 #endif //_KVI_INTTYPES_H_
char kvi_i8_t
Definition: kvi_inttypes.h:99
unsigned long long int kvi_u64_t
Definition: kvi_inttypes.h:66
unsigned char kvi_u8_t
Definition: kvi_inttypes.h:100
long long int kvi_i64_t
SYSTEM_SIZE_OF_SHORT_INT.
Definition: kvi_inttypes.h:65
This file contains compile time settings.