mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
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:
parent
bc7acf9f7a
commit
6e05dcadb6
8 changed files with 18 additions and 19 deletions
|
@ -6,7 +6,7 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
static const size_t size_dropped = std::numeric_limits<size_t>::max();
|
||||
static const std::size_t size_dropped = -1;
|
||||
|
||||
/*
|
||||
C-style format parser. Appends formatted string to `out`, returns number of characters written.
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <array>
|
||||
|
||||
using std::chrono::steady_clock;
|
||||
|
@ -515,13 +514,13 @@ constexpr inline struct umax_helper
|
|||
template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>>
|
||||
explicit constexpr operator T() const
|
||||
{
|
||||
return std::numeric_limits<S>::max();
|
||||
return static_cast<S>(-1);
|
||||
}
|
||||
|
||||
template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>>
|
||||
constexpr bool operator==(const T& rhs) const
|
||||
{
|
||||
return rhs == std::numeric_limits<S>::max();
|
||||
return rhs == static_cast<S>(-1);
|
||||
}
|
||||
|
||||
#if __cpp_impl_three_way_comparison >= 201711 && !__INTELLISENSE__
|
||||
|
@ -529,7 +528,7 @@ constexpr inline struct umax_helper
|
|||
template <typename T>
|
||||
friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator==(const T& lhs, const umax_helper& rhs)
|
||||
{
|
||||
return lhs == std::numeric_limits<simple_t<T>>::max();
|
||||
return lhs == static_cast<simple_t<T>>(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -538,13 +537,13 @@ constexpr inline struct umax_helper
|
|||
template <typename T, typename S = simple_t<T>, typename = std::enable_if_t<std::is_unsigned_v<S>>>
|
||||
constexpr bool operator!=(const T& rhs) const
|
||||
{
|
||||
return rhs != std::numeric_limits<S>::max();
|
||||
return rhs != static_cast<S>(-1);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
friend constexpr std::enable_if_t<std::is_unsigned_v<simple_t<T>>, bool> operator!=(const T& lhs, const umax_helper& rhs)
|
||||
{
|
||||
return lhs != std::numeric_limits<simple_t<T>>::max();
|
||||
return lhs != static_cast<simple_t<T>>(-1);
|
||||
}
|
||||
#endif
|
||||
} umax;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include "Utilities/StrFmt.h"
|
||||
|
||||
enum CPUDisAsmMode
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "Emu/NP/np_handler.h"
|
||||
|
||||
#include <limits>
|
||||
#include <chrono>
|
||||
#include <shared_mutex>
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ namespace
|
|||
template <typename T>
|
||||
constexpr T index_limit()
|
||||
{
|
||||
return std::numeric_limits<T>::max();
|
||||
return -1;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue