diff options
| -rw-r--r-- | zencore/include/zencore/intmath.h | 6 | ||||
| -rw-r--r-- | zenhttp/httpasio.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/zencore/include/zencore/intmath.h b/zencore/include/zencore/intmath.h index f24caed6e..608ce2962 100644 --- a/zencore/include/zencore/intmath.h +++ b/zencore/include/zencore/intmath.h @@ -176,6 +176,12 @@ Max(auto x, auto y) return x > y ? x : y; } +constexpr auto +Clamp(auto x, auto l, auto h) +{ + return x < l ? l : x < h ? x : h; +} + ////////////////////////////////////////////////////////////////////////// void intmath_forcelink(); // internal diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp index 39a363711..4a5bf1724 100644 --- a/zenhttp/httpasio.cpp +++ b/zenhttp/httpasio.cpp @@ -1261,7 +1261,7 @@ HttpAsioServer::RegisterService(HttpService& Service) int HttpAsioServer::Initialize(int BasePort) { - m_BasePort = m_Impl->Start(gsl::narrow<uint16_t>(BasePort), Max(std::thread::hardware_concurrency(), 8u)); + m_BasePort = m_Impl->Start(gsl::narrow<uint16_t>(BasePort), Clamp(std::thread::hardware_concurrency(), 8u, 64u)); return m_BasePort; } |