Post Reply 
 
Thread Rating:
  • 31 Votes - 2.97 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code checking
Author Message
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #1
code checking
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:

gbGfx.cpp
first declaration in line 94
second declaration in line 291
(This post was last modified: 08-31-2009 06:23 AM by spacy51.)
08-31-2009 05:56 AM
Visit this user's website Find all posts by this user Quote this message in a reply
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #2
RE: code checking
Here is another issue:

gb.cpp, line 1592
Code:
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?
(This post was last modified: 08-31-2009 06:02 AM by spacy51.)
08-31-2009 06:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #3
RE: code checking
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?
08-31-2009 06:05 AM
Visit this user's website Find all posts by this user Quote this message in a reply
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #4
RE: code checking
There are several cases of variables like x, or i defined multiple times, but I guess that's negligible.
08-31-2009 06:29 AM
Visit this user's website Find all posts by this user Quote this message in a reply
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #5
RE: code checking
rpi.cpp, line 141:
Quote: *(pOCur++) = ((*pICur & 0xF800) << rshiftDiff) |
((*pICur & 0x07E0) << gshiftDiff) |
((*pICur & 0x001F) << bshiftDiff);
*pICur++;


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.
(This post was last modified: 08-31-2009 06:59 AM by spacy51.)
08-31-2009 06:59 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

 Quick Theme: