Skip to content

Commit

Permalink
Fix some MISRA warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Oct 15, 2023
1 parent 8768fd9 commit cfe1687
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/internal/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ constexpr auto cmp_less( T first, U second ) noexcept -> bool {
if constexpr ( std::is_signed< T >::value == std::is_signed< U >::value ) {
return first < second;
} else if constexpr ( std::is_signed< T >::value ) {
return first < 0 || UT( first ) < second;
return ( first < 0 ) || ( UT( first ) < second );
} else {
return second >= 0 && first < UU( second );
return ( second >= 0 ) && ( first < UU( second ) );
}
}

Expand All @@ -115,13 +115,13 @@ cmp_less( T t, U u ) noexcept -> std::enable_if_t< std::is_signed< T >::value ==
template< class T, class U >
constexpr auto
cmp_less( T t, U u ) noexcept -> std::enable_if_t< std::is_signed< T >::value && !std::is_signed< U >::value, bool > {
return t < 0 || std::make_unsigned_t< T >( t ) < u;
return ( t < 0 ) || ( std::make_unsigned_t< T >( t ) < u );
}

template< class T, class U >
constexpr auto
cmp_less( T t, U u ) noexcept -> std::enable_if_t< !std::is_signed< T >::value && std::is_signed< U >::value, bool > {
return u >= 0 && t < std::make_unsigned_t< U >( u );
return ( u >= 0 ) && ( t < std::make_unsigned_t< U >( u ) );
}

#endif
Expand Down

0 comments on commit cfe1687

Please sign in to comment.