diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/geometry_func.cpp | 4 | ||||
-rw-r--r-- | src/core/kdtree.hpp | 3 | ||||
-rw-r--r-- | src/core/math_func.hpp | 62 | ||||
-rw-r--r-- | src/core/pool_func.hpp | 6 | ||||
-rw-r--r-- | src/core/smallmatrix_type.hpp | 4 | ||||
-rw-r--r-- | src/core/smallstack_type.hpp | 4 | ||||
-rw-r--r-- | src/core/smallvec_type.hpp | 1 |
7 files changed, 11 insertions, 73 deletions
diff --git a/src/core/geometry_func.cpp b/src/core/geometry_func.cpp index 162f2eae5..89e70fb5b 100644 --- a/src/core/geometry_func.cpp +++ b/src/core/geometry_func.cpp @@ -22,7 +22,7 @@ Dimension maxdim(const Dimension &d1, const Dimension &d2) { Dimension d; - d.width = max(d1.width, d2.width); - d.height = max(d1.height, d2.height); + d.width = std::max(d1.width, d2.width); + d.height = std::max(d1.height, d2.height); return d; } diff --git a/src/core/kdtree.hpp b/src/core/kdtree.hpp index c37ab8eea..392e31b8e 100644 --- a/src/core/kdtree.hpp +++ b/src/core/kdtree.hpp @@ -12,7 +12,6 @@ #include "../stdafx.h" #include <vector> -#include <algorithm> #include <limits> /** @@ -261,7 +260,7 @@ class Kdtree { best = SelectNearestNodeDistance(best, this->FindNearestRecursive(xy, next, level + 1)); } - limit = min(best.second, limit); + limit = std::min(best.second, limit); /* Check if the distance from current best is worse than distance from target to splitting line, * if it is we also need to check the other side of the split. */ diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index 55061066a..222b4120e 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -11,66 +11,6 @@ #define MATH_FUNC_HPP /** - * Returns the maximum of two values. - * - * This function returns the greater value of two given values. - * If they are equal the value of a is returned. - * - * @param a The first value - * @param b The second value - * @return The greater value or a if equals - */ -template <typename T> -static inline T max(const T a, const T b) -{ - return (a >= b) ? a : b; -} - -/** - * Returns the minimum of two values. - * - * This function returns the smaller value of two given values. - * If they are equal the value of b is returned. - * - * @param a The first value - * @param b The second value - * @return The smaller value or b if equals - */ -template <typename T> -static inline T min(const T a, const T b) -{ - return (a < b) ? a : b; -} - -/** - * Returns the minimum of two integer. - * - * This function returns the smaller value of two given integers. - * - * @param a The first integer - * @param b The second integer - * @return The smaller value - */ -static inline int min(const int a, const int b) -{ - return min<int>(a, b); -} - -/** - * Returns the minimum of two unsigned integers. - * - * This function returns the smaller value of two given unsigned integers. - * - * @param a The first unsigned integer - * @param b The second unsigned integer - * @return The smaller value - */ -static inline uint minu(const uint a, const uint b) -{ - return min<uint>(a, b); -} - -/** * Returns the absolute value of (scalar) variable. * * @note assumes variable to be signed @@ -216,7 +156,7 @@ static inline uint16 ClampToU16(const uint64 a) * match for min(uint64, uint) than uint64 min(uint64, uint64). As such we * need to cast the UINT16_MAX to prevent MSVC from displaying its * infinite loads of warnings. */ - return static_cast<uint16>(min<uint64>(a, static_cast<uint64>(UINT16_MAX))); + return static_cast<uint16>(std::min(a, static_cast<uint64>(UINT16_MAX))); } /** diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index db79ab285..dea108f08 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -52,7 +52,7 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index) assert(index >= this->size); assert(index < Tmax_size); - size_t new_size = min(Tmax_size, Align(index + 1, Tgrowth_step)); + size_t new_size = std::min(Tmax_size, Align(index + 1, Tgrowth_step)); this->data = ReallocT(this->data, new_size); MemSetT(this->data + this->size, 0, new_size - this->size); @@ -100,7 +100,7 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index) { assert(this->data[index] == nullptr); - this->first_unused = max(this->first_unused, index + 1); + this->first_unused = std::max(this->first_unused, index + 1); this->items++; Titem *item; @@ -187,7 +187,7 @@ DEFINE_POOL_METHOD(void)::FreeItem(size_t index) free(this->data[index]); } this->data[index] = nullptr; - this->first_free = min(this->first_free, index); + this->first_free = std::min(this->first_free, index); this->items--; if (!this->cleaning) Titem::PostDestructor(index); } diff --git a/src/core/smallmatrix_type.hpp b/src/core/smallmatrix_type.hpp index 0aeac10e1..03fd1b790 100644 --- a/src/core/smallmatrix_type.hpp +++ b/src/core/smallmatrix_type.hpp @@ -234,7 +234,7 @@ public: if (x * new_height > new_capacity) continue; (*copy)(new_data + (x - 1) * new_height, this->data + (x - 1) * this->height, - min(this->height, new_height)); + std::min(this->height, new_height)); } } else { /* If matrix is shrinking copy from the front. */ @@ -242,7 +242,7 @@ public: if ((x + 1) * new_height > new_capacity) break; (*copy)(new_data + x * new_height, this->data + x * this->height, - min(this->height, new_height)); + std::min(this->height, new_height)); } } } diff --git a/src/core/smallstack_type.hpp b/src/core/smallstack_type.hpp index bf44f00c8..c05454b8a 100644 --- a/src/core/smallstack_type.hpp +++ b/src/core/smallstack_type.hpp @@ -46,7 +46,7 @@ public: if (index < Tmax_size) { this->data[index].valid = true; this->first_free = index + 1; - this->first_unused = max(this->first_unused, this->first_free); + this->first_unused = std::max(this->first_unused, this->first_free); } return index; } @@ -58,7 +58,7 @@ public: inline void Destroy(Tindex index) { this->data[index].valid = false; - this->first_free = min(this->first_free, index); + this->first_free = std::min(this->first_free, index); } private: diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index 2f65f0292..92fd938be 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -13,7 +13,6 @@ #include "alloc_func.hpp" #include "mem_func.hpp" #include <vector> -#include <algorithm> /** * Helper function to append an item to a vector if it is not already contained |