openbsd-ports/lang/oo2c/patches/patch-lib_src___oo2c_h
jasper 2b652e0076 - various fixes, as GCC would generate incorrect code (what's new..)
from Alexander Shiryaev (MAINTAINER)
ok landry@
2011-01-18 12:03:19 +00:00

22 lines
1.0 KiB
Plaintext

$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 */