VBA-M Forums

Full Version: code checking
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using the VC++ code analysis tool to improve the code quality.

I found an unclarity where "u8 attrs" is defined twice in one function.
It would be great if someone who knows the GB code could check that up:

first declaration in line 94
second declaration in line 291
Here is another issue:

gb.cpp, line 1592
switch(address & 0xf000) {
  case 0x0a:
  case 0x0b:

The case marks can not be reached because of the strange bitmask in the switch statement. Has to be an error. Maybe a bit-shift is missing?
More around that area:

gb.cpp, Line 1637:
Quote: case 0x44:
if (((gbHardware & 7) && ((gbLcdMode == 1) && (gbLcdTicks == 0x71))) ||
(!(register_LCDC && 0x80)))
return 0;

shouldn't that be a bitwise and instead of a logic one?
There are several cases of variables like x, or i defined multiple times, but I guess that's negligible.
rpi.cpp, line 141:
Quote: *(pOCur++) = ((*pICur & 0xF800) << rshiftDiff) |
((*pICur & 0x07E0) << gshiftDiff) |
((*pICur & 0x001F) << bshiftDiff);

Can have two meanings: either increment value at address, or increment pointer after accessing value. I don't know what's right.

The same issue in line 160.
Reference URL's