From 8861cb4a3a355de554b9a2ea04b97fc1d5a7c0a6 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 26 Sep 2015 00:33:08 -0500 Subject: [PATCH] Replace a few mod-by-power-of-2 operations with bit masking, since ORCA/C wasn't optimizing them --- mouse.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mouse.cc b/mouse.cc index 472d005..7c6e1df 100644 --- a/mouse.cc +++ b/mouse.cc @@ -234,7 +234,7 @@ void DoCursor (void) { *(imageLine + n) ^= 0xFF; /* Reverse color */ *(imageLine + n) &= *(maskLine + n); } - if (rectWidth % 2) { + if (rectWidth & 0x01) { *(imageLine + n) = coltab320[*(dataPtr++)] & 0xF0; *(imageLine + n) ^= 0xFF; /* Reverse color */ *(imageLine + n) &= *(maskLine + n); @@ -270,9 +270,9 @@ void DoCursor (void) { *(imageLine + n) &= *(maskLine + n); } - if (rectWidth % 4) { + if (rectWidth & 0x03) { *(imageLine + n) = 0; - for (j = 0; j < rectWidth % 4; j++) { + for (j = 0; j < (rectWidth & 0x03); j++) { *(imageLine + n) += coltab640[*(dataPtr++)] & (0xC0 >> j*2); } *(imageLine + n) ^= 0xFF; /* Reverse color */