Fix udiv(), negative values were giving wrong results
This commit is contained in:
parent
94c5d5a78c
commit
6515ac2c94
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user