diff --git a/ev_limits.h b/ev_limits.h new file mode 100644 index 0000000..28e4b51 --- /dev/null +++ b/ev_limits.h @@ -0,0 +1,83 @@ +#ifndef EV_HEADERS_LIMITS_H +#define EV_HEADERS_LIMITS_H + +#include "ev_types.h" + +struct Int8Data { i8 MIN; i8 MAX; }; +struct Int16Data { i16 MIN; i16 MAX; }; +struct Int32Data { i32 MIN; i32 MAX; }; +struct Int64Data { i64 MIN; i64 MAX; }; + +struct UInt8Data { u8 MIN; u8 MAX; }; +struct UInt16Data { u16 MIN; u16 MAX; }; +struct UInt32Data { u32 MIN; u32 MAX; }; +struct UInt64Data { u64 MIN; u64 MAX; }; + +struct Float32Data { f32 MIN; f32 MAX; f32 MIN_POS; f32 EPS; }; +struct Float64Data { f64 MIN; f64 MAX; f64 MIN_POS; f64 EPS; }; + +static const struct Int8Data Int8 = +{ + .MIN = -128, + .MAX = 127 +}; + +static const struct Int16Data Int16 = +{ + .MIN = -32767-1, + .MAX = 32767 +}; + +static const struct Int32Data Int32 = +{ + .MIN = -2147483647-1, + .MAX = 2147483647 +}; + +static const struct Int64Data Int64 = +{ + .MIN = -(9223372036854775807LL)-1, + .MAX = 9223372036854775807LL +}; + +static const struct UInt8Data UInt8 = +{ + .MIN = 0, + .MAX = 255 +}; + +static const struct UInt16Data UInt16 = +{ + .MIN = 0, + .MAX = 65535 +}; + +static const struct UInt32Data UInt32 = +{ + .MIN = 0, + .MAX = 4294967295U +}; + +static const struct UInt64Data UInt64 = +{ + .MIN = 0, + .MAX = 18446744073709551615ULL +}; + +static const struct Float32Data Float32 = +{ + .MIN_POS = 1.175494351e-38, + .MIN = -3.402823466e+38, + .MAX = 3.402823466e+38, + .EPS = 1.192093e-07 +}; + +static const struct Float64Data Float64 = +{ + .MIN_POS = 2.2250738585072014e-308, + .MIN = -1.7976931348623158e+308, + .MAX = 1.7976931348623158e+308, + .EPS = 2.2204460492503131e-016 +}; + +#endif // EV_HEADERS_LIMITS_H diff --git a/ev_types.h b/ev_types.h new file mode 100644 index 0000000..ef2a0f2 --- /dev/null +++ b/ev_types.h @@ -0,0 +1,20 @@ +#ifndef EV_HEADERS_TYPES_H +#define EV_HEADERS_TYPES_H + +// Signed integers +typedef signed char i8; +typedef short int i16; +typedef int i32; +typedef long long int i64; + +// Unsigned integers +typedef unsigned char u8; +typedef unsigned short int u16; +typedef unsigned int u32; +typedef unsigned long long int u64; + +// Floating-Point Numbers +typedef float f32; +typedef double f64; + +#endif // EV_HEADERS_TYPES_H