Skip to content

Commit

Permalink
xrCore: Fix definitions of type_min and type_zero and add `type_l…
Browse files Browse the repository at this point in the history
…owest`
  • Loading branch information
AMS21 committed Nov 17, 2023
1 parent c0a0491 commit e5e0f11
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/xrCore/xr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ template <typename T>
constexpr auto type_max = std::numeric_limits<T>::max();

template <typename T>
constexpr auto type_min = -std::numeric_limits<T>::max();
constexpr auto type_lowest = std::numeric_limits<T>::lowest();

template <typename T>
constexpr auto type_zero = std::numeric_limits<T>::min();
constexpr auto type_min = std::numeric_limits<T>::min();

template <typename T>
constexpr auto type_zero = T(0);

template <typename T>
constexpr auto type_epsilon = std::numeric_limits<T>::epsilon();
Expand All @@ -43,16 +46,18 @@ constexpr int int_zero = type_zero<int>;

constexpr float flt_max = type_max<float>;
constexpr float flt_min = type_min<float>;
constexpr float flt_lowest = type_lowest<float>;
constexpr float flt_zero = type_zero<float>;
constexpr float flt_eps = type_epsilon<float>;

#undef FLT_MAX
#undef FLT_MIN
#define FLT_MAX flt_max
#define FLT_MIN flt_min
#define FLT_MIN flt_lowest

constexpr double dbl_max = type_max<double>;
constexpr double dbl_min = type_min<double>;
constexpr double dbl_lowest = type_lowest<double>;
constexpr double dbl_zero = type_zero<double>;
constexpr double dbl_eps = type_epsilon<double>;

Expand Down

0 comments on commit e5e0f11

Please sign in to comment.