Fix udiv(), negative values were giving wrong results

master
Marc Gilleron 2019-06-02 01:46:41 +01:00
parent 94c5d5a78c
commit 6515ac2c94
1 changed files with 1 additions and 1 deletions

View File

@ -110,7 +110,7 @@ inline void append_array(std::vector<T> &dst, const std::vector<T> &src) {
inline int udiv(int x, int d) {
if (x < 0) {
return (x + d - 1) / d;
return (x - d + 1) / d;
} else {
return x / d;
}