Post Reply 
 
Thread Rating:
  • 19 Votes - 2.47 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unnecessary double check?
Author Message
spacy51 Offline
VBA-M Developer
*******

Posts: 451
Joined: Mar 2008
Reputation: 3
Post: #1
Unnecessary double check?
gba.cpp, Ln 2645:
Quote: case 0xC6:
{
bool start= ((DM1CNT_H ^ value) & 0x8000) ? true : false;
value &= 0xF7E0;

DM1CNT_H = value;
UPDATE_REG(0xC6, DM1CNT_H);

if(start && (value & 0x8000)) {
dma1Source = DM1SAD_L | (DM1SAD_H << 16);
dma1Dest = DM1DAD_L | (DM1DAD_H << 16);
CPUCheckDMA(0, 2);
}
}
break;

My personal logic tells me that the bold part is unneeded.
(This post was last modified: 08-18-2009 07:48 AM by spacy51.)
08-18-2009 07:47 AM
Visit this user's website Find all posts by this user Quote this message in a reply
jbo_85 Offline
VBA-M Developer
*******

Posts: 9
Joined: Mar 2008
Reputation: 0
Post: #2
RE: Unnecessary double check?
The bold part is needed. It fails if DM1CNT_H or value is >= 0x8000.
08-18-2009 09:12 AM
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: Unnecessary double check?
Look at the beginning.
start is only true if bit 15 of value is set, so it does not make sense to seperately check for that again in the bold part.
(This post was last modified: 08-18-2009 10:13 AM by spacy51.)
08-18-2009 10:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
jbo_85 Offline
VBA-M Developer
*******

Posts: 9
Joined: Mar 2008
Reputation: 0
Post: #4
RE: Unnecessary double check?
(08-18-2009 10:13 AM)spacy51 Wrote:  Look at the beginning.
start is only true if bit 15 of value is set, so it does not make sense to seperately check for that again in the bold part.
It tests bit 15 of (DM1CNT_H ^ value) and not just bit 15 of value.
08-18-2009 10:18 AM
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: