Skip to content

Commit

Permalink
Vif Unpack: initialise UnpkNoOfIterations before use.
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Oct 2, 2016
1 parent 744d07b commit 471f33c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pcsx2/x86/newVif_Dynarec.cpp
Expand Up @@ -209,6 +209,7 @@ void VifUnpackSSE_Dynarec::CompileRoutine() {

uint vNum = vB.num ? vB.num : 256;
doMode = (upkNum == 0xf) ? 0 : doMode; // V4_5 has no mode feature.
UnpkNoOfIterations = 0;
MSKPATH3_LOG("Compiling new block, unpack number %x, mode %x, masking %x, vNum %x", upkNum, doMode, doMask, vNum);

pxAssume(vCL == 0);
Expand Down

8 comments on commit 471f33c

@gregory38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you agree with me that value is never written otherwise. So it is a constant to 0. As far as I can see, it only used here

pcsx2/x86/newVif_Dynarec.cpp:224:       if(UnpkNoOfIterations == 0) 
pcsx2/x86/newVif_Dynarec.cpp-225-           ShiftDisplacementWindow( srcIndirect, edx ); //Don't need to do this otherwise as we arent reading the source.

I'm not sure why we need it.

@refractionpcsx2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nargh, I wish I could remember why I did any of that now.. I'm sure there was a reason I did that, or did I get myself confused with UnpkLoopIteration.

It could be we either don't need it at all or we always need it. I honestly can't remember :/ I know I was trying to reduce the number of memory reads/moves happening

@gregory38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok. Too bad. Feel free to improve the situation if you remember.

@refractionpcsx2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it comes back to me I will, right now it works, so that's good enough :P

@jcdenton2k
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why commenting your code decently is a good practice ;)

@refractionpcsx2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I know, I'm just way too lazy :P

@ramapcsx2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@refractionpcsx2 You could comment that you plan to add comments later. It creates that little nag that will make you do it some day. This kind of code really requires full documentation. Chances are that you find a few more bugs this way, as well.

@refractionpcsx2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I'll do that tonight

Please sign in to comment.