This commit is contained in:
Бранимир Караџић
2022-08-26 21:27:05 -07:00
parent dbafa143d9
commit 68dfd59820
2 changed files with 10 additions and 10 deletions

View File

@@ -38,15 +38,15 @@
namespace bx
{
/// Returns true if type `Ty` is trivially copyable / POD type.
template<class Ty>
template<typename Ty>
constexpr bool isTriviallyCopyable();
/// Find the address of an object of a class that has an overloaded unary ampersand (&) operator.
template <class Ty>
template<typename Ty>
Ty* addressOf(Ty& _a);
/// Find the address of an object of a class that has an overloaded unary ampersand (&) operator.
template <class Ty>
template<typename Ty>
const Ty* addressOf(const Ty& _a);
///

View File

@@ -27,13 +27,13 @@ namespace bx
return _x;
}
template<class Ty>
template<typename Ty>
inline constexpr bool isTriviallyCopyable()
{
return __is_trivially_copyable(Ty);
}
template<class Ty>
template<typename Ty>
inline Ty* addressOf(Ty& _a)
{
return reinterpret_cast<Ty*>(
@@ -43,7 +43,7 @@ namespace bx
);
}
template<class Ty>
template<typename Ty>
inline const Ty* addressOf(const Ty& _a)
{
return reinterpret_cast<const Ty*>(
@@ -71,20 +71,20 @@ namespace bx
Ty tmp = _a; _a = _b; _b = tmp;
}
template<class Ty>
template<typename Ty>
struct IsSignedT { static constexpr bool value = Ty(-1) < Ty(0); };
template<class Ty, bool SignT = IsSignedT<Ty>::value>
template<typename Ty, bool SignT = IsSignedT<Ty>::value>
struct Limits;
template<class Ty>
template<typename Ty>
struct Limits<Ty, true>
{
static constexpr Ty max = ( ( (Ty(1) << ( (sizeof(Ty) * 8) - 2) ) - Ty(1) ) << 1) | Ty(1);
static constexpr Ty min = -max - Ty(1);
};
template<class Ty>
template<typename Ty>
struct Limits<Ty, false>
{
static constexpr Ty min = 0;