* matching Do_destroy from resource.cpp

* add missing constants from `float.c`

* add numeric_limits for double

* set TObject::reset for each version in stb.cpp

* improve debug matching
This commit is contained in:
kipcode66
2025-12-15 20:00:16 -05:00
committed by GitHub
parent 1901b7b78f
commit dcbdd76f0b
12 changed files with 203 additions and 38 deletions
@@ -0,0 +1,90 @@
#ifndef MSL_TYPE_TRAITS_H_
#define MSL_TYPE_TRAITS_H_
#include <stddef.h>
namespace std {
// helper class
template<class T, T v> struct integral_constant { static const T value = v;};
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template <bool B, typename T = void>
struct enable_if {};
template <typename T>
struct enable_if<true, T> { typedef T type; };
template<class T> struct remove_reference { typedef T type; };
template<class T> struct remove_reference<T&> { typedef T type; };
template<bool B, class T, class F>
struct conditional { typedef T type; };
template<class T, class F>
struct conditional<false, T, F> { typedef F type; };
template<class T>
struct is_array : false_type {};
template<class T>
struct is_array<T[]> : std::true_type {};
template<class T, size_t N>
struct is_array<T[N]> : std::true_type {};
template <typename T>
struct add_pointer
{
typedef T* type;
};
template <typename T>
struct add_pointer<T&>
{
typedef T* type;
};
template <typename T>
struct add_pointer<T const&>
{
typedef T* type;
};
template <typename T>
struct add_pointer<T volatile&>
{
typedef T* type;
};
template <typename T>
struct add_pointer<T const volatile&>
{
typedef T* type;
};
template<class T>
struct remove_extent { typedef T type; };
template<class T>
struct remove_extent<T[]> { typedef T type; };
template<class T, size_t N>
struct remove_extent<T[N]> { typedef T type; };
template<class T> struct remove_cv { typedef T type; };
template<class T> struct remove_cv<const T> { typedef T type; };
template<class T> struct remove_cv<volatile T> { typedef T type; };
template<class T> struct remove_cv<const volatile T> { typedef T type; };
template<class T> struct remove_const { typedef T type; };
template<class T> struct remove_const<const T> { typedef T type; };
template<class T> struct remove_volatile { typedef T type; };
template<class T> struct remove_volatile<volatile T> { typedef T type; };
template<class T, class U>
struct is_same : std::false_type {};
template<class T>
struct is_same<T, T> : std::true_type {};
}
#endif
@@ -104,8 +104,20 @@ class numeric_limits<float> {
public:
inline static float min();
inline static float max() { return FLT_MAX; }
inline static float signaling_NaN() { return *(float*)__float_nan; }
};
#if __REVOLUTION_SDK__
template <>
class numeric_limits<double> {
public:
static const unsigned long long x = 0x7ff0000000000001ULL;
inline static double min();
inline static double max();
inline static double signaling_NaN() { return *reinterpret_cast<const double*>(&x); }
};
#endif
} // namespace std
#endif
#endif
@@ -4,6 +4,12 @@ unsigned long __float_nan[] = {0x7FFFFFFF};
unsigned long __float_huge[] = {0x7F800000};
#if !__REVOLUTION_SDK__
unsigned long __float_max[] = {0x7F7FFFFF};
unsigned long __float_epsilon[] = {0x34000000};
#endif
#if DEBUG
unsigned long long __double_huge[] = {0x7ff0000000000000ULL};
#endif