Merge pull request #4 from henriquegemignani/bugfix/algorithm-header

algorithm.hpp header fixes
This commit is contained in:
Phillip Stephens 2022-09-30 05:52:25 -07:00 committed by GitHub
commit ec3349c646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 16 deletions

View File

@ -1,18 +1,10 @@
#ifndef _RSTL_MATH_HPP #ifndef _RSTL_ALGORITHM_HPP
#define _RSTL_MATH_HPP #define _RSTL_ALGORITHM_HPP
#include "rstl/pointer_iterator.hpp" #include "rstl/pointer_iterator.hpp"
namespace rstl { namespace rstl {
template < typename T > template < typename T >
inline const T& min_val(const T& a, const T& b) {
return (b < a) ? b : a;
}
template < typename T >
inline const T& max_val(const T& a, const T& b) {
return (a < b) ? b : a;
}
template < class Iter, class T > template < class Iter, class T >
inline Iter find(Iter first, Iter last, const T& val) { inline Iter find(Iter first, Iter last, const T& val) {
@ -21,4 +13,4 @@ inline Iter find(Iter first, Iter last, const T& val) {
return first; return first;
} }
} // namespace rstl } // namespace rstl
#endif // _RSTL_MATH_HPP #endif // _RSTL_ALGORITHM_HPP

View File

@ -5,12 +5,13 @@
namespace rstl { namespace rstl {
template < typename T > template < typename T >
static inline const T& max_val(const T& a, const T& b) { inline const T& min_val(const T& a, const T& b) {
return a > b ? a : b; return (b < a) ? b : a;
} }
template < typename T > template < typename T >
static inline const T& min_val(const T& a, const T& b) { inline const T& max_val(const T& a, const T& b) {
return a < b ? a : b; return (a < b) ? b : a;
} }
} // namespace rstl } // namespace rstl

View File

@ -2,7 +2,7 @@
#include "Kyoto/Streams/CInputStream.hpp" #include "Kyoto/Streams/CInputStream.hpp"
#include "rstl/algorithm.hpp" #include "rstl/math.hpp"
CColor::CColor(CInputStream& in) { CColor::CColor(CInputStream& in) {
float r = in.ReadFloat(); float r = in.ReadFloat();