From f612df16597bbae73707d0dc9a90235b3de26c6e Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Sat, 19 Jan 2019 12:45:45 +0000 Subject: Preemptively fix more potential valgrind problems. Again, while we know that a+b = a|b when (a&b)==0 (ignoring overflow), valgrind is not that smart, and can hence incorrectly get undefinedness calculations wrong. Fix cases in gdevm2 that look wrong, in the same way as the previous commit fixed gdevm1. --- base/gdevm2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base/gdevm2.c') diff --git a/base/gdevm2.c b/base/gdevm2.c index 8b34dfd7d..04a0e60de 100644 --- a/base/gdevm2.c +++ b/base/gdevm2.c @@ -116,7 +116,7 @@ mem_mapped2_copy_mono(gx_device * dev, } else { /* Filling a mask. */ for ( ; ; ) { if (sbyte & bit) - *pptr = (*pptr & ~mask) + (b1 & mask); + *pptr = (*pptr & ~mask) | (b1 & mask); if (--count <= 0) break; if ((bit >>= 1) == 0) @@ -129,7 +129,7 @@ mem_mapped2_copy_mono(gx_device * dev, for ( ; ; ) { if (!(sbyte & bit)) { if (zero != gx_no_color_index) - *pptr = (*pptr & ~mask) + (b0 & mask); + *pptr = (*pptr & ~mask) | (b0 & mask); } if (--count <= 0) break; -- cgit v1.2.1