Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/aircraft_cmd.cpp # src/blitter/32bpp_anim.cpp # src/cargopacket.cpp # src/cheat_gui.cpp # src/company_cmd.cpp # src/company_gui.cpp # src/core/pool_func.hpp # src/date.cpp # src/economy.cpp # src/error_gui.cpp # src/ground_vehicle.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/industry_cmd.cpp # src/lang/dutch.txt # src/lang/french.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/linkgraph/mcf.cpp # src/network/network_content.cpp # src/network/network_server.cpp # src/network/network_udp.cpp # src/newgrf_engine.cpp # src/newgrf_station.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/pathfinder/follow_track.hpp # src/pathfinder/yapf/yapf_common.hpp # src/saveload/saveload.cpp # src/settings_gui.cpp # src/station_cmd.cpp # src/station_kdtree.h # src/string_func.h # src/table/settings.ini # src/tgp.cpp # src/timetable_cmd.cpp # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train_cmd.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/tunnelbridge_cmd.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/video/sdl_v.cpp # src/video/win32_v.cpp # src/viewport.cpp # src/viewport_sprite_sorter_sse4.cpp # src/window.cpp
This commit is contained in:
@@ -10,66 +10,6 @@
|
||||
#ifndef MATH_FUNC_HPP
|
||||
#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.
|
||||
*
|
||||
@@ -239,7 +179,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)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user