$OpenBSD: patch-lib_src___oo2c_h,v 1.1 2011/01/18 12:03:19 jasper Exp $ --- lib/src/__oo2c.h.orig Sat Dec 24 15:55:21 2005 +++ lib/src/__oo2c.h Tue Jan 18 13:47:55 2011 @@ -152,7 +152,7 @@ extern OOC_INT32 _cmp32(const OOC_CHAR32* l, const OOC /* def: _x MOD _y >= 0 for _y>0, and undefined otherwise */ #define _div(_x,_y) ({ \ typeof(_x) _quot = _x / _y; \ - if ((_x<0) && (_y>0) && (_quot*_y!=_x)) _quot--; \ + if ((((_x<0) && (_y>0)) || ((_x>0) && (_y<0))) && (_quot*_y!=_x)) _quot--; \ _quot; }) /* MOD(integer, integer) -- note: macro uses gcc style expression statement */ @@ -164,7 +164,7 @@ extern OOC_INT32 _cmp32(const OOC_CHAR32* l, const OOC /* def: _x MOD _y >= 0 for _y>0, and undefined otherwise */ #define _mod(_x,_y) ({ \ typeof(_x) _rem = _x % _y; \ - if ((_x<0) && (_y>0) && (_rem != 0)) _rem += _y; \ + if ((((_x<0) && (_y>0)) || ((_x>0) && (_y<0))) && (_rem != 0)) _rem += _y; \ _rem; }) /* i IN s */