Skip to content

Commit

Permalink
Update comments in UnsignedMin
Browse files Browse the repository at this point in the history
  • Loading branch information
noloader committed Jun 24, 2023
1 parent 3e0742f commit acb48cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,12 @@ template <class T> inline const T& STDMAX(const T& a, const T& b)
/// \param a the first value
/// \param b the second value
/// \return the minimum value based on a comparison a and b using <tt>operator&lt;</tt>.
/// \details The comparison <tt>b \< a</tt> is performed and the value returned is a's type T1.
/// \details The comparison <tt>b \< a</tt> is performed and the value returned is type T1.
template <class T1, class T2> inline const T1 UnsignedMin(const T1& a, const T2& b)
{
CRYPTOPP_COMPILE_ASSERT((sizeof(T1)<=sizeof(T2) && T2(-1)>0) || (sizeof(T1)>sizeof(T2) && T1(-1)>0));
CRYPTOPP_COMPILE_ASSERT(std::numeric_limits<T1>::is_signed == false);
CRYPTOPP_COMPILE_ASSERT(std::numeric_limits<T2>::is_signed == false);

if (sizeof(T1)<=sizeof(T2))
return b < (T2)a ? (T1)b : a;
Expand Down

0 comments on commit acb48cc

Please sign in to comment.