Jump to content
Visual Boy Advance-M
Sign in to follow this  
spacy51

code checking

Recommended Posts

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

More around that area:

 

gb.cpp, Line 1637:

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?

Share this post


Link to post
Share on other sites

There are several cases of variables like x, or i defined multiple times, but I guess that's negligible.

Share this post


Link to post
Share on other sites

rpi.cpp, line 141:

*(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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×