maths: revert invalid 'simplification' of round_to

This commit is contained in:
Danny Robson 2017-08-30 15:37:39 +10:00
parent 4826b4c466
commit 5126bb486c

View File

@ -262,8 +262,11 @@ namespace util {
>::type >::type
round_to (T value, U size) round_to (T value, U size)
{ {
auto remainder = value % size; // we perform this as two steps to avoid unnecessarily incrementing when
return value + size - remainder; // remainder is zero.
if (value % size)
value += size - value % size;
return value;
} }