2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BEAST_CORE_DETAIL_CLAMP_HPP
9 #define BEAST_CORE_DETAIL_CLAMP_HPP
22 if(x >= (std::numeric_limits<std::size_t>::max)())
23 return (std::numeric_limits<std::size_t>::max)();
24 return static_cast<std::size_t>(x);
30 clamp(UInt x, std::size_t limit)
34 return static_cast<std::size_t>(x);