From 30e40047c58aef32d3d407888a79f6d68b9c2579 Mon Sep 17 00:00:00 2001 From: Robear Selwans Date: Sun, 2 Jan 2022 14:51:59 +0200 Subject: [PATCH] Merged ev_types and ev_limits to ev_numeric Signed-off-by: Robear Selwans --- ev_limits.h => ev_numeric.h | 180 +++++++++++++++++++----------------- ev_types.h | 20 ---- 2 files changed, 97 insertions(+), 103 deletions(-) rename ev_limits.h => ev_numeric.h (73%) delete mode 100644 ev_types.h diff --git a/ev_limits.h b/ev_numeric.h similarity index 73% rename from ev_limits.h rename to ev_numeric.h index 28e4b51..160163f 100644 --- a/ev_limits.h +++ b/ev_numeric.h @@ -1,83 +1,97 @@ -#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 +#ifndef EV_HEADERS_NUMERIC_H +#define EV_HEADERS_NUMERIC_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; + +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_NUMERIC_H diff --git a/ev_types.h b/ev_types.h deleted file mode 100644 index ef2a0f2..0000000 --- a/ev_types.h +++ /dev/null @@ -1,20 +0,0 @@ -#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