adamdebreceni commented on a change in pull request #875:
URL: https://github.com/apache/nifi-minifi-cpp/pull/875#discussion_r498148335



##########
File path: libminifi/include/utils/GeneralUtils.h
##########
@@ -43,6 +43,7 @@ using std::make_unique;
 
 template<typename T, typename = typename 
std::enable_if<std::is_integral<T>::value>::type>
 T intdiv_ceil(T numerator, T denominator) {
+  gsl_Expects(denominator != 0);
   // note: division and remainder is 1 instruction on x86
   return numerator / denominator + (numerator % denominator > 0);

Review comment:
       I know this is old code, but unless we restrict the domain of this 
function to non-negative arguments, it might give incorrect results, e.g. 
`intdiv_ceil(-5, -3) == 1`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to