/
sizes.ch
110 lines (87 loc) · 2.91 KB
/
sizes.ch
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
%%[8
#ifndef __BASE_SIZES_H__
#define __BASE_SIZES_H__
%%]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Hardcoded / configured sizes + types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Signed & unsigned ints of explicit sizes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%[8
#define Word64_SizeInBits 64
#define Word64_SizeInBits_Log 6
#define Word64_SizeInBytes 8
#define Word64_SizeInBytes_Log 3
#define Word32_SizeInBits 32
#define Word32_SizeInBits_Log 5
#define Word32_SizeInBytes 4
#define Word32_SizeInBytes_Log 2
#define Word16_SizeInBits 16
#define Word16_SizeInBits_Log 4
#define Word16_SizeInBytes 2
#define Word16_SizeInBytes_Log 1
#define Word8_SizeInBits 8
#define Word8_SizeInBits_Log 3
#define Word8_SizeInBytes 1
#define Word8_SizeInBytes_Log 0
%%]
%%[8
#define Int64_SizeInBits Word64_SizeInBits
#define Int32_SizeInBits Word32_SizeInBits
#define Int16_SizeInBits Word16_SizeInBits
#define Int8_SizeInBits Word8_SizeInBits
%%]
%%[8
#define Int64_MinValue INT64_MIN
#define Int64_MaxValue INT64_MAX
#define Int32_MinValue INT32_MIN
#define Int32_MaxValue INT32_MAX
#define Int16_MinValue INT16_MIN
#define Int16_MaxValue INT16_MAX
#define Int8_MinValue INT8_MIN
#define Int8_MaxValue INT8_MAX
#define Word64_MinValue 0
#define Word64_MaxValue UINT64_MAX
#define Word32_MinValue 0
#define Word32_MaxValue UINT32_MAX
#define Word16_MinValue 0
#define Word16_MaxValue UINT16_MAX
#define Word8_MinValue 0
#define Word8_MaxValue UINT8_MAX
%%]
%%[8
#ifdef __UHC_TARGET_BC__
# define Int_MinValue (Bits_MinSInt(Word,Word_SizeInBits,Word_SizeInBits-GB_Word_SizeOfWordTag)+1)
# define Int_MaxValue (Bits_MaxSInt(Word,Word_SizeInBits,Word_SizeInBits-GB_Word_SizeOfWordTag))
# if USE_64_BITS
# define Word_MinValue Word64_MinValue
# define Word_MaxValue (Word64_MaxValue >> GB_Word_SizeOfWordTag)
# else
# define Word_MinValue Word32_MinValue
# define Word_MaxValue (Word32_MaxValue >> GB_Word_SizeOfWordTag)
# endif
#else
# if USE_64_BITS
# define Int_MinValue Int64_MinValue
# define Int_MaxValue Int64_MaxValue
# define Word_MinValue Word64_MinValue
# define Word_MaxValue Word64_MaxValue
# else
# define Int_MinValue Int32_MinValue
# define Int_MaxValue Int32_MaxValue
# define Word_MinValue Word32_MinValue
# define Word_MaxValue Word32_MaxValue
# endif
#endif
%%]
%%[8
#define Byte_SizeInBits 8
#define Byte_SizeInBits_Log 3
%%]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% EOF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%[8
#endif /* __BASE_SIZES_H__ */
%%]