-
Notifications
You must be signed in to change notification settings - Fork 68
/
types_cpp.hpp
62 lines (56 loc) · 1.59 KB
/
types_cpp.hpp
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
// Author: Plyashkevich Viatcheslav <[email protected]>
//
// 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 option) any later version.
//--------------------------------------------------------------------------
// All rights reserved.
#if !_BASE_TYPES_
#define _BASE_TYPES_ 1
// http://stackoverflow.com/questions/12863738/what-is-this-c-code-attempting-to-achieve
template<int, int, int, int> class Types;
template <> class Types<5, 4, 2, 1>
{
public:
typedef long int Int40;
typedef unsigned long int Uint40;
typedef int Int32;
typedef unsigned int Uint32;
typedef short int Int16;
typedef unsigned short int Uint16;
typedef char Int8;
typedef unsigned char Uint8;
};
template <> class Types<8, 4, 2, 1>
{
public:
typedef long int Int64;
typedef unsigned long int Uint64;
typedef int Int32;
typedef unsigned int Uint32;
typedef short int Int16;
typedef unsigned short int Uint16;
typedef char Int8;
typedef unsigned char Uint8;
};
template <> class Types<4, 4, 2, 1>
{
public:
typedef int Int32;
typedef unsigned int Uint32;
typedef short int Int16;
typedef unsigned short int Uint16;
typedef char Int8;
typedef unsigned char Uint8;
};
// For 16bit chars
template <> class Types<2, 1, 1, 1>
{
public:
typedef long int Int32;
typedef unsigned long int Uint32;
typedef short int Int16;
typedef unsigned short int Uint16;
};
#endif