Reduce std::numeric_limits dependency

Please, stop pretending...
You need these templates for generic code.
In other words, in another templates.
Stop increasing compilation time for no reason.
This commit is contained in:
Nekotekina 2020-12-12 12:00:21 +03:00
parent bc7acf9f7a
commit 6e05dcadb6
8 changed files with 18 additions and 19 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <string>
#include <limits>
#include "Utilities/StrFmt.h"
enum CPUDisAsmMode

View file

@ -25,7 +25,6 @@
#include "Emu/NP/np_handler.h"
#include <limits>
#include <chrono>
#include <shared_mutex>

View file

@ -685,7 +685,7 @@ namespace
template <typename T>
constexpr T index_limit()
{
return std::numeric_limits<T>::max();
return -1;
}
template <typename T>

View file

@ -132,10 +132,10 @@ private:
const s32 rem = calibData.sensNumer % calibData.sensDenom;
const s32 output = (quot * biased) + ((rem * biased) / calibData.sensDenom);
if (output > std::numeric_limits<s16>::max())
return std::numeric_limits<s16>::max();
else if (output < std::numeric_limits<s16>::min())
return std::numeric_limits<s16>::min();
if (output > INT16_MAX)
return INT16_MAX;
else if (output < INT16_MIN)
return INT16_MIN;
else return static_cast<s16>(output);
}

View file

@ -22,10 +22,10 @@ namespace gui
// Get minimum virtual screen x & y for clamping the
// window x & y later while taking the width and height
// into account, so they don't go offscreen
s32 min_screen_x = std::numeric_limits<s32>::max();
s32 max_screen_x = std::numeric_limits<s32>::min();
s32 min_screen_y = std::numeric_limits<s32>::max();
s32 max_screen_y = std::numeric_limits<s32>::min();
s32 min_screen_x = INT32_MAX;
s32 max_screen_x = INT32_MIN;
s32 min_screen_y = INT32_MAX;
s32 max_screen_y = INT32_MIN;
for (auto screen : QApplication::screens())
{
auto screen_geometry = screen->availableGeometry();

View file

@ -1463,7 +1463,7 @@ public:
}
// Conditionally decrement
bool try_dec(simple_type greater_than = std::numeric_limits<simple_type>::min())
bool try_dec(simple_type greater_than)
{
type _new, old = atomic_storage<type>::load(m_data);
@ -1486,7 +1486,7 @@ public:
}
// Conditionally increment
bool try_inc(simple_type less_than = std::numeric_limits<simple_type>::max())
bool try_inc(simple_type less_than)
{
type _new, old = atomic_storage<type>::load(m_data);