mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Cleanup.
This commit is contained in:
@@ -87,27 +87,27 @@ namespace bx
|
||||
|
||||
/// Returns minimum of two values.
|
||||
template<typename Ty>
|
||||
constexpr Ty min(const Ty& _a, const Ty& _b);
|
||||
constexpr Ty min(const Ty& _a, const TypeIdentityType<Ty>& _b);
|
||||
|
||||
/// Returns maximum of two values.
|
||||
template<typename Ty>
|
||||
constexpr Ty max(const Ty& _a, const Ty& _b);
|
||||
constexpr Ty max(const Ty& _a, const TypeIdentityType<Ty>& _b);
|
||||
|
||||
/// Returns minimum of three or more values.
|
||||
template<typename Ty, typename... Args>
|
||||
constexpr Ty min(const Ty& _a, const Ty& _b, const Args&... _args);
|
||||
constexpr Ty min(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args);
|
||||
|
||||
/// Returns maximum of three or more values.
|
||||
template<typename Ty, typename... Args>
|
||||
constexpr Ty max(const Ty& _a, const Ty& _b, const Args&... _args);
|
||||
constexpr Ty max(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args);
|
||||
|
||||
/// Returns middle of three or more values.
|
||||
template<typename Ty, typename... Args>
|
||||
constexpr Ty mid(const Ty& _a, const Ty& _b, const Args&... _args);
|
||||
constexpr Ty mid(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args);
|
||||
|
||||
/// Returns clamped value between min/max.
|
||||
template<typename Ty>
|
||||
constexpr Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max);
|
||||
constexpr Ty clamp(const Ty& _a, const TypeIdentityType<Ty>& _min, const TypeIdentityType<Ty>& _max);
|
||||
|
||||
/// Returns true if value `_a` is power of 2.
|
||||
template<typename Ty>
|
||||
|
||||
@@ -106,37 +106,37 @@ namespace bx
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline constexpr Ty min(const Ty& _a, const Ty& _b)
|
||||
inline constexpr Ty min(const Ty& _a, const TypeIdentityType<Ty>& _b)
|
||||
{
|
||||
return _a < _b ? _a : _b;
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline constexpr Ty max(const Ty& _a, const Ty& _b)
|
||||
inline constexpr Ty max(const Ty& _a, const TypeIdentityType<Ty>& _b)
|
||||
{
|
||||
return _a > _b ? _a : _b;
|
||||
}
|
||||
|
||||
template<typename Ty, typename... Args>
|
||||
inline constexpr Ty min(const Ty& _a, const Ty& _b, const Args&... _args)
|
||||
inline constexpr Ty min(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args)
|
||||
{
|
||||
return min(min(_a, _b), _args...);
|
||||
}
|
||||
|
||||
template<typename Ty, typename... Args>
|
||||
inline constexpr Ty max(const Ty& _a, const Ty& _b, const Args&... _args)
|
||||
inline constexpr Ty max(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args)
|
||||
{
|
||||
return max(max(_a, _b), _args...);
|
||||
}
|
||||
|
||||
template<typename Ty, typename... Args>
|
||||
inline constexpr Ty mid(const Ty& _a, const Ty& _b, const Args&... _args)
|
||||
inline constexpr Ty mid(const Ty& _a, const TypeIdentityType<Ty>& _b, const Args&... _args)
|
||||
{
|
||||
return max(min(_a, _b), min(max(_a, _b), _args...) );
|
||||
}
|
||||
|
||||
template<typename Ty>
|
||||
inline constexpr Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max)
|
||||
inline constexpr Ty clamp(const Ty& _a, const TypeIdentityType<Ty>& _min, const TypeIdentityType<Ty>& _max)
|
||||
{
|
||||
return max(min(_a, _max), _min);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user