Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    422061

Untitled

Sign in to follow this  

76 views

EPIC FAIL:

// Get number of bytes read so far
u32 getNumBytes() const
{
if(m_nOffset&8)
return m_nOffset/8 + 1;
return m_nOffset/8;
}


I spent 3 hours tracking down this sodding save CRC bug. The problem is that the CRC was right all along, it was just saving one byte too few (The CRC is at the end of the data), so the last few bits of the CRC were chopped off.

See if you can spot the bug, it's reasonably obvious (m_nOffset is in bits).
Sign in to follow this  


4 Comments


Recommended Comments

Quote:
Original post by benryves
m_nOffset%8 or m_nOffset&7, I guess? Glad you got it fixed. [grin]
Have a cookie :)
[smile]

Share this comment


Link to comment
I thought the following was the standard way to do this?

// Get number of bytes read so far
u32 getNumBytes() const
{
return (m_nOffset+7)/8;
}

Share this comment


Link to comment
Quote:
Original post by rick_appleton
I thought the following was the standard way to do this?
*** Source Snippet Removed ***
Yup, that's what I've changed it to [smile]

Share this comment


Link to comment

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