src
utils
detect_sizes.cpp
Go to the documentation of this file.
1
8
/*****************************************************************************
9
** Includes
10
*****************************************************************************/
11
12
#include <iomanip>
13
#include <iostream>
14
#include <
ecl/config/portable_types.hpp
>
15
#include <
ecl/type_traits/numeric_limits.hpp
>
16
17
/*****************************************************************************
18
** using
19
*****************************************************************************/
20
21
using
ecl::int8;
22
using
ecl::uint8;
23
using
ecl::int16;
24
using
ecl::uint16;
25
using
ecl::int32;
26
using
ecl::uint32;
27
using
ecl::int64;
28
using
ecl::uint64;
29
using
ecl::numeric_limits
;
30
31
/*****************************************************************************
32
** Main
33
*****************************************************************************/
34
35
int
main
() {
36
37
std::cout << std::endl;
38
std::cout <<
"***********************************************************"
<< std::endl;
39
std::cout <<
" numeric_limits<>"
<< std::endl;
40
std::cout <<
"***********************************************************"
<< std::endl;
41
std::cout << std::endl;
42
43
std::cout <<
"numeric_limits<char>::bytes "
<<
numeric_limits<char>::bytes
<< std::endl;
44
std::cout <<
"numeric_limits<char>::bits "
<<
numeric_limits<char>::bits
<< std::endl;
45
std::cout <<
"numeric_limits<char>::min "
<<
static_cast<
int
>
(
numeric_limits<char>::minimum
) << std::endl;
46
std::cout <<
"numeric_limits<char>::max "
<<
static_cast<
int
>
(
numeric_limits<char>::maximum
) << std::endl;
47
std::cout << std::endl;
48
49
std::cout <<
"numeric_limits<unsigned char>::bytes "
<<
numeric_limits<unsigned char>::bytes
<< std::endl;
50
std::cout <<
"numeric_limits<unsigned char>::bits "
<<
numeric_limits<unsigned char>::bits
<< std::endl;
51
std::cout <<
"numeric_limits<unsigned char>::min "
<<
static_cast<
int
>
(
numeric_limits<unsigned char>::minimum
) << std::endl;
52
std::cout <<
"numeric_limits<unsigned char>::max "
<<
static_cast<
int
>
(
numeric_limits<unsigned char>::maximum
) << std::endl;
53
std::cout << std::endl;
54
55
std::cout <<
"numeric_limits<short>::bytes "
<<
numeric_limits<short>::bytes
<< std::endl;
56
std::cout <<
"numeric_limits<short>::bits "
<<
numeric_limits<short>::bits
<< std::endl;
57
std::cout <<
"numeric_limits<short>::min "
<<
numeric_limits<short>::minimum
<< std::endl;
58
std::cout <<
"numeric_limits<short>::max "
<<
numeric_limits<short>::maximum
<< std::endl;
59
std::cout << std::endl;
60
61
std::cout <<
"numeric_limits<unsigned short>::bytes "
<<
numeric_limits<unsigned short>::bytes
<< std::endl;
62
std::cout <<
"numeric_limits<unsigned short>::bits "
<<
numeric_limits<unsigned short>::bits
<< std::endl;
63
std::cout <<
"numeric_limits<unsigned short>::min "
<<
numeric_limits<unsigned short>::minimum
<< std::endl;
64
std::cout <<
"numeric_limits<unsigned short>::max "
<<
numeric_limits<unsigned short>::maximum
<< std::endl;
65
std::cout << std::endl;
66
67
std::cout <<
"numeric_limits<int>::bytes "
<<
numeric_limits<int>::bytes
<< std::endl;
68
std::cout <<
"numeric_limits<int>::bits "
<<
numeric_limits<int>::bits
<< std::endl;
69
std::cout <<
"numeric_limits<int>::min "
<<
numeric_limits<int>::minimum
<< std::endl;
70
std::cout <<
"numeric_limits<int>::max "
<<
numeric_limits<int>::maximum
<< std::endl;
71
std::cout << std::endl;
72
73
std::cout <<
"numeric_limits<unsigned int>::bytes "
<<
numeric_limits<unsigned int>::bytes
<< std::endl;
74
std::cout <<
"numeric_limits<unsigned int>::bits "
<<
numeric_limits<unsigned int>::bits
<< std::endl;
75
std::cout <<
"numeric_limits<unsigned int>::min "
<<
numeric_limits<unsigned int>::minimum
<< std::endl;
76
std::cout <<
"numeric_limits<unsigned int>::max "
<<
numeric_limits<unsigned int>::maximum
<< std::endl;
77
std::cout << std::endl;
78
79
std::cout <<
"numeric_limits<long>::bytes "
<<
numeric_limits<long>::bytes
<< std::endl;
80
std::cout <<
"numeric_limits<long>::bits "
<<
numeric_limits<long>::bits
<< std::endl;
81
std::cout <<
"numeric_limits<long>::min "
<<
numeric_limits<long>::minimum
<< std::endl;
82
std::cout <<
"numeric_limits<long>::max "
<<
numeric_limits<long>::maximum
<< std::endl;
83
std::cout << std::endl;
84
85
std::cout <<
"numeric_limits<unsigned long>::bytes "
<<
numeric_limits<unsigned long>::bytes
<< std::endl;
86
std::cout <<
"numeric_limits<unsigned long>::bits "
<<
numeric_limits<unsigned long>::bits
<< std::endl;
87
std::cout <<
"numeric_limits<unsigned long>::min "
<<
numeric_limits<unsigned long>::minimum
<< std::endl;
88
std::cout <<
"numeric_limits<unsigned long>::max "
<<
numeric_limits<unsigned long>::maximum
<< std::endl;
89
std::cout << std::endl;
90
91
std::cout <<
"numeric_limits<long long>::bytes "
<<
numeric_limits<long long>::bytes
<< std::endl;
92
std::cout <<
"numeric_limits<long long>::bits "
<<
numeric_limits<long long>::bits
<< std::endl;
93
std::cout <<
"numeric_limits<long long>::min "
<<
numeric_limits<long long>::minimum
<< std::endl;
94
std::cout <<
"numeric_limits<long long>::max "
<<
numeric_limits<long long>::maximum
<< std::endl;
95
std::cout << std::endl;
96
97
std::cout <<
"numeric_limits<unsigned long long>::bytes "
<<
numeric_limits<unsigned long long>::bytes
<< std::endl;
98
std::cout <<
"numeric_limits<unsigned long long>::bits "
<<
numeric_limits<unsigned long long>::bits
<< std::endl;
99
std::cout <<
"numeric_limits<unsigned long long>::min "
<<
numeric_limits<unsigned long long>::minimum
<< std::endl;
100
std::cout <<
"numeric_limits<unsigned long long>::max "
<<
numeric_limits<unsigned long long>::maximum
<< std::endl;
101
102
// std::cout << std::endl;
103
// std::cout << "***********************************************************" << std::endl;
104
// std::cout << " Integer<>" << std::endl;
105
// std::cout << "***********************************************************" << std::endl;
106
// std::cout << std::endl;
107
//
108
// Integer<8>::type int_8 = 0x03;
109
// Integer<8>::utype uint_8 = 0x03;
110
// std::cout << "Integer<8>::type: " << int_8 << std::endl;
111
// std::cout << "Integer<8>::utype: " << uint_8 << std::endl;
112
// std::cout << "Integer<8>::min " << static_cast<int>(Integer<8>::min) << std::endl;
113
// std::cout << "Integer<8>::one " << static_cast<int>(Integer<8>::one) << std::endl;
114
// std::cout << "Integer<8>::max " << static_cast<int>(Integer<8>::max) << std::endl;
115
// std::cout << "Integer<8>::umin " << static_cast<int>(Integer<8>::umin) << std::endl;
116
// std::cout << "Integer<8>::uone " << static_cast<int>(Integer<8>::uone) << std::endl;
117
// std::cout << "Integer<8>::umax " << static_cast<int>(Integer<8>::umax) << std::endl;
118
// std::cout << std::endl;
119
//
120
// Integer<16>::type int_16 = 0x03;
121
// Integer<16>::utype uint_16 = 0x03;
122
// std::cout << "Integer<16>::type: " << int_16 << std::endl;
123
// std::cout << "Integer<16>::utype: " << uint_16 << std::endl;
124
// std::cout << "Integer<16>::min " << Integer<16>::min << std::endl;
125
// std::cout << "Integer<16>::one " << Integer<16>::one << std::endl;
126
// std::cout << "Integer<16>::max " << Integer<16>::max << std::endl; // This doesn't output the correct value.
127
// std::cout << "Integer<16>::umin " << Integer<16>::umin << std::endl;
128
// std::cout << "Integer<16>::uone " << Integer<16>::uone << std::endl;
129
// std::cout << "Integer<16>::umax " << Integer<16>::umax << std::endl;
130
// std::cout << std::endl;
131
//
132
// Integer<32>::type int_32 = 0x03;
133
// Integer<32>::utype uint_32 = 0x03;
134
// std::cout << "Integer<32>::type: " << int_32 << std::endl;
135
// std::cout << "Integer<32>::utype: " << uint_32 << std::endl;
136
// std::cout << "Integer<32>::min " << Integer<32>::min << std::endl;
137
// std::cout << "Integer<32>::one " << Integer<32>::one << std::endl;
138
// std::cout << "Integer<32>::max " << Integer<32>::max << std::endl; // This doesn't output the correct value.
139
// std::cout << "Integer<32>::umin " << Integer<32>::umin << std::endl;
140
// std::cout << "Integer<32>::uone " << Integer<32>::uone << std::endl;
141
// std::cout << "Integer<32>::umax " << Integer<32>::umax << std::endl;
142
// std::cout << std::endl;
143
//
144
// Integer<64>::type int_64 = 0x03;
145
// Integer<64>::utype uint_64 = 0x03;
146
// std::cout << "Integer<64>::type: " << int_64 << std::endl;
147
// std::cout << "Integer<64>::utype: " << uint_64 << std::endl;
148
// std::cout << "Integer<64>::min " << Integer<64>::min << std::endl;
149
// std::cout << "Integer<64>::one " << Integer<64>::one << std::endl;
150
// std::cout << "Integer<64>::max " << Integer<64>::max << std::endl; // This doesn't output the correct value.
151
// std::cout << "Integer<64>::umin " << Integer<64>::umin << std::endl;
152
// std::cout << "Integer<64>::uone " << Integer<64>::uone << std::endl;
153
// std::cout << "Integer<64>::umax " << Integer<64>::umax << std::endl;
154
// std::cout << std::endl;
155
156
return
0;
157
}
main
int main()
Definition:
detect_sizes.cpp:35
ecl::numeric_limits
Expands the std numeric_limits class.
Definition:
numeric_limits.hpp:56
portable_types.hpp
numeric_limits.hpp
Expand on the std numeric limits classes.
ecl_type_traits
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:18:32