Compatibility for MSVC and MinGW
This commit is contained in:
@@ -75,13 +75,13 @@
|
||||
#define DBL_MAX_10_EXP 308
|
||||
#define DBL_TRAPS 0
|
||||
#define DBL_TINYNESS_BEFORE 0
|
||||
#define DBL_MIN fennec::bit_cast<double>(0x10000000000000l)
|
||||
#define DBL_MAX fennec::bit_cast<double>(0x7fefffffffffffffl)
|
||||
#define DBL_EPSILON fennec::bit_cast<double>(0x3cb0000000000000l)
|
||||
#define DBL_INF fennec::bit_cast<double>(0x7ff0000000000000l)
|
||||
#define DBL_QUIET_NAN fennec::bit_cast<double>(0x7ff8000000000000l)
|
||||
#define DBL_SIGNALING_NAN fennec::bit_cast<double>(0x7ff4000000000000l)
|
||||
#define DBL_DENORM_MIN fennec::bit_cast<double>(0x1l)
|
||||
#define DBL_ROUND_ERR fennec::bit_cast<double>(0x3fe0000000000000l)
|
||||
#define DBL_MIN fennec::bit_cast<double>(0x10000000000000ll)
|
||||
#define DBL_MAX fennec::bit_cast<double>(0x7fefffffffffffffll)
|
||||
#define DBL_EPSILON fennec::bit_cast<double>(0x3cb0000000000000ll)
|
||||
#define DBL_INF fennec::bit_cast<double>(0x7ff0000000000000ll)
|
||||
#define DBL_QUIET_NAN fennec::bit_cast<double>(0x7ff8000000000000ll)
|
||||
#define DBL_SIGNALING_NAN fennec::bit_cast<double>(0x7ff4000000000000ll)
|
||||
#define DBL_DENORM_MIN fennec::bit_cast<double>(0x1ll)
|
||||
#define DBL_ROUND_ERR fennec::bit_cast<double>(0x3fe0000000000000ll)
|
||||
|
||||
#endif // FENNEC_LANG_FLOAT_H
|
||||
|
||||
@@ -30,8 +30,26 @@
|
||||
#ifndef FENNEC_LANG_INTEGER_H
|
||||
#define FENNEC_LANG_INTEGER_H
|
||||
|
||||
#undef CHAR_MIN
|
||||
#undef CHAR_MAX
|
||||
#undef WCHAR_MIN
|
||||
#undef WCHAR_MAX
|
||||
#undef SCHAR_MIN
|
||||
#undef SCHAR_MAX
|
||||
#undef UCHAR_MIN
|
||||
#undef UCHAR_MAX
|
||||
#undef INT_MIN
|
||||
#undef INT_MAX
|
||||
#undef UINT_MIN
|
||||
#undef UINT_MAX
|
||||
#undef LONG_MIN
|
||||
#undef LONG_MAX
|
||||
#undef ULONG_MIN
|
||||
#undef ULONG_MAX
|
||||
#undef LLONG_MIN
|
||||
#undef LLONG_MAX
|
||||
#undef ULLONG_MIN
|
||||
#undef ULLONG_MAX
|
||||
|
||||
#define CHAR_IS_SIGNED true
|
||||
#define CHAR_ROUNDS 0x0
|
||||
@@ -43,15 +61,15 @@
|
||||
#define CHAR_MIN 0xffffff80
|
||||
#define CHAR_MAX 0x7f
|
||||
|
||||
#define WCHAR_IS_SIGNED true
|
||||
#define WCHAR_IS_SIGNED false
|
||||
#define WCHAR_ROUNDS 0x0
|
||||
#define WCHAR_RADIX_DIG 0x1f
|
||||
#define WCHAR_DIG 0x9
|
||||
#define WCHAR_RADIX_DIG 0x10
|
||||
#define WCHAR_DIG 0x4
|
||||
#define WCHAR_DECIMAL_DIG 0x0
|
||||
#define WCHAR_RADIX 0x2
|
||||
#define WCHAR_TRAPS 0xtrue
|
||||
#define WCHAR_MIN 0x80000000
|
||||
#define WCHAR_MAX 0x7fffffff
|
||||
#define WCHAR_MIN 0x0
|
||||
#define WCHAR_MAX 0xffff
|
||||
|
||||
#define SCHAR_ROUNDS 0x0
|
||||
#define SCHAR_RADIX_DIG 0x7
|
||||
@@ -108,22 +126,22 @@
|
||||
#define UINT_MAX 0xffffffff
|
||||
|
||||
#define LONG_ROUNDS 0x0
|
||||
#define LONG_RADIX_DIG 0x3f
|
||||
#define LONG_DIG 0x12
|
||||
#define LONG_RADIX_DIG 0x1f
|
||||
#define LONG_DIG 0x9
|
||||
#define LONG_DECIMAL_DIG 0x0
|
||||
#define LONG_RADIX 0x2
|
||||
#define LONG_TRAPS 0xtrue
|
||||
#define LONG_MIN 0x8000000000000000
|
||||
#define LONG_MAX 0x7fffffffffffffff
|
||||
#define LONG_MIN 0x80000000
|
||||
#define LONG_MAX 0x7fffffff
|
||||
|
||||
#define ULONG_ROUNDS 0x0
|
||||
#define ULONG_RADIX_DIG 0x40
|
||||
#define ULONG_DIG 0x13
|
||||
#define ULONG_RADIX_DIG 0x20
|
||||
#define ULONG_DIG 0x9
|
||||
#define ULONG_DECIMAL_DIG 0x0
|
||||
#define ULONG_RADIX 0x2
|
||||
#define ULONG_TRAPS 0xtrue
|
||||
#define ULONG_MIN 0x0
|
||||
#define ULONG_MAX 0xffffffffffffffff
|
||||
#define ULONG_MAX 0xffffffff
|
||||
|
||||
#define LLONG_ROUNDS 0x0
|
||||
#define LLONG_RADIX_DIG 0x3f
|
||||
|
||||
@@ -102,14 +102,14 @@ inline void float_h()
|
||||
out << "#define DBL_TRAPS " << std::dec << std::numeric_limits<double>::traps << std::endl;
|
||||
out << "#define DBL_TINYNESS_BEFORE " << std::dec << std::numeric_limits<double>::tinyness_before << std::endl;
|
||||
|
||||
out << "#define DBL_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::min() ) << "l)" << std::endl;
|
||||
out << "#define DBL_MAX " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::max() ) << "l)" << std::endl;
|
||||
out << "#define DBL_EPSILON " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::epsilon() ) << "l)" << std::endl;
|
||||
out << "#define DBL_INF " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::infinity() ) << "l)" << std::endl;
|
||||
out << "#define DBL_QUIET_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::quiet_NaN() ) << "l)" << std::endl;
|
||||
out << "#define DBL_SIGNALING_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::signaling_NaN()) << "l)" << std::endl;
|
||||
out << "#define DBL_DENORM_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::denorm_min() ) << "l)" << std::endl;
|
||||
out << "#define DBL_ROUND_ERR " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::round_error() ) << "l)" << std::endl;
|
||||
out << "#define DBL_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::min() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_MAX " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::max() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_EPSILON " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::epsilon() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_INF " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::infinity() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_QUIET_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::quiet_NaN() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_SIGNALING_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::signaling_NaN()) << "ll)" << std::endl;
|
||||
out << "#define DBL_DENORM_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::denorm_min() ) << "ll)" << std::endl;
|
||||
out << "#define DBL_ROUND_ERR " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::round_error() ) << "ll)" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
|
||||
@@ -64,8 +64,26 @@ inline void integer_h()
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#undef CHAR_MIN" << std::endl;
|
||||
out << "#undef CHAR_MAX" << std::endl;
|
||||
out << "#undef WCHAR_MIN" << std::endl;
|
||||
out << "#undef WCHAR_MAX" << std::endl;
|
||||
out << "#undef SCHAR_MIN" << std::endl;
|
||||
out << "#undef SCHAR_MAX" << std::endl;
|
||||
out << "#undef UCHAR_MIN" << std::endl;
|
||||
out << "#undef UCHAR_MAX" << std::endl;
|
||||
out << "#undef INT_MIN" << std::endl;
|
||||
out << "#undef INT_MAX" << std::endl;
|
||||
out << "#undef UINT_MIN" << std::endl;
|
||||
out << "#undef UINT_MAX" << std::endl;
|
||||
out << "#undef LONG_MIN" << std::endl;
|
||||
out << "#undef LONG_MAX" << std::endl;
|
||||
out << "#undef ULONG_MIN" << std::endl;
|
||||
out << "#undef ULONG_MAX" << std::endl;
|
||||
out << "#undef LLONG_MIN" << std::endl;
|
||||
out << "#undef LLONG_MAX" << std::endl;
|
||||
out << "#undef ULLONG_MIN" << std::endl;
|
||||
out << "#undef ULLONG_MAX" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
@@ -212,7 +230,7 @@ inline void integer_h()
|
||||
out << "#define ULONG_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long int>::digits10 << std::endl;
|
||||
out << "#define ULONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long int>::max_digits10 << std::endl;
|
||||
out << "#define ULONG_RADIX " << "0x" << std::hex << std::numeric_limits<unsigned long int>::radix << std::endl;
|
||||
out << "#define ULONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned long int>::traps << std::endl;
|
||||
out << "#define ULONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned long int>::traps << std::endl;
|
||||
|
||||
out << "#define ULONG_MIN " << "0x" << std::hex << std::numeric_limits<unsigned long int>::min() << std::endl;
|
||||
out << "#define ULONG_MAX " << "0x" << std::hex << std::numeric_limits<unsigned long int>::max() << std::endl;
|
||||
@@ -224,7 +242,7 @@ inline void integer_h()
|
||||
out << "#define LLONG_DIG " << "0x" << std::hex << std::numeric_limits<long long>::digits10 << std::endl;
|
||||
out << "#define LLONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<long long>::max_digits10 << std::endl;
|
||||
out << "#define LLONG_RADIX " << "0x" << std::hex << std::numeric_limits<long long>::radix << std::endl;
|
||||
out << "#define LLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<long long>::traps << std::endl;
|
||||
out << "#define LLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<long long>::traps << std::endl;
|
||||
|
||||
out << "#define LLONG_MIN " << "0x" << std::hex << std::numeric_limits<long long>::min() << std::endl;
|
||||
out << "#define LLONG_MAX " << "0x" << std::hex << std::numeric_limits<long long>::max() << std::endl;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// =====================================================================================================================
|
||||
|
||||
#include <fennec/memory/new.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef FENNEC_MEMORY_DEBUGGER
|
||||
@@ -33,15 +34,28 @@ inline void* operator new[](fennec::size_t size) { ret
|
||||
inline void* operator new (fennec::size_t size, const fennec::nothrow_t&) { return malloc(size); }
|
||||
inline void* operator new[](fennec::size_t size, const fennec::nothrow_t&) { return malloc(size); }
|
||||
|
||||
// Aligned allocation functions
|
||||
// Aligned allocation & deallocation functions
|
||||
#ifdef _WIN32
|
||||
inline void operator delete (void* ptr) noexcept { _aligned_free(ptr); }
|
||||
inline void operator delete[](void* ptr) noexcept { _aligned_free(ptr); }
|
||||
inline void operator delete (void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { _aligned_free(ptr); }
|
||||
inline void operator delete[](void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { _aligned_free(ptr); }
|
||||
|
||||
inline void* operator new (fennec::size_t size, fennec::align_t align) { return _aligned_malloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new[](fennec::size_t size, fennec::align_t align) { return _aligned_malloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new (fennec::size_t size, fennec::align_t align, const fennec::nothrow_t&) { return _aligned_malloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new[](fennec::size_t size, fennec::align_t align, const fennec::nothrow_t&) { return _aligned_malloc(static_cast<size_t>(align), size); }
|
||||
#else
|
||||
inline void operator delete (void* ptr) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr) noexcept { free(ptr); }
|
||||
inline void operator delete (void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
|
||||
inline void* operator new (fennec::size_t size, fennec::align_t align) { return aligned_alloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new[](fennec::size_t size, fennec::align_t align) { return aligned_alloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new (fennec::size_t size, fennec::align_t align, const fennec::nothrow_t&) { return aligned_alloc(static_cast<size_t>(align), size); }
|
||||
inline void* operator new[](fennec::size_t size, fennec::align_t align, const fennec::nothrow_t&) { return aligned_alloc(static_cast<size_t>(align), size); }
|
||||
|
||||
// Deallocation functions
|
||||
inline void operator delete (void* ptr) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr) noexcept { free(ptr); }
|
||||
#endif
|
||||
|
||||
// Aligned deallocation functions
|
||||
inline void operator delete (void* ptr, fennec::align_t) noexcept { free(ptr); }
|
||||
@@ -56,8 +70,6 @@ inline void operator delete[](void* ptr, fennec::size_t, fennec::align_t) noexce
|
||||
// Non-throwing deallocation functions
|
||||
inline void operator delete (void* ptr, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete (void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr, fennec::align_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete (void* ptr, fennec::size_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
inline void operator delete[](void* ptr, fennec::size_t, const fennec::nothrow_t&) noexcept { free(ptr); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user