B
Belloc
Guest
#define INT8_MIN (-127i8 - 1)
#define INT16_MIN (-32767i16 - 1)
#define INT32_MIN (-2147483647i32 - 1)
#define INT64_MIN (-9223372036854775807i64 - 1)
#define INT8_MAX 127i8
#define INT16_MAX 32767i16
#define INT32_MAX 2147483647i32
#define INT64_MAX 9223372036854775807i64
#define UINT8_MAX 0xffui8
#define UINT16_MAX 0xffffui16
#define UINT32_MAX 0xffffffffui32
#define UINT64_MAX 0xffffffffffffffffui64
For example, this snippet compiles
#include<cstdint>
#include <iostream>
int main() {
std::cout << INT8_MIN << '\n';
std::cout << INT16_MIN << '\n';
std::cout << INT32_MIN << '\n';
std::cout << INT64_MIN << '\n';
}
and prints the numbers below as expected.
-128
-32768
-2147483648
-9223372036854775808
Continue reading...
#define INT16_MIN (-32767i16 - 1)
#define INT32_MIN (-2147483647i32 - 1)
#define INT64_MIN (-9223372036854775807i64 - 1)
#define INT8_MAX 127i8
#define INT16_MAX 32767i16
#define INT32_MAX 2147483647i32
#define INT64_MAX 9223372036854775807i64
#define UINT8_MAX 0xffui8
#define UINT16_MAX 0xffffui16
#define UINT32_MAX 0xffffffffui32
#define UINT64_MAX 0xffffffffffffffffui64
For example, this snippet compiles
#include<cstdint>
#include <iostream>
int main() {
std::cout << INT8_MIN << '\n';
std::cout << INT16_MIN << '\n';
std::cout << INT32_MIN << '\n';
std::cout << INT64_MIN << '\n';
}
and prints the numbers below as expected.
-128
-32768
-2147483648
-9223372036854775808
Continue reading...