I have some code I'm tinkering with but ran into an if statement I could possibly eliminate but not sure if I should. The code is this:
Now bare with me here. I converted the PPU_Status And 64 to a function which technically is checking the 7th bit of PPU_Status to see if its 1 or 0. Which is true, see this:
So now the if statement looks like this:
Ok now lets look at the And statement in more detail.
And
--------
1 And 1 = 1
1 And 0 = 0
0 And 1 = 0
0 And 0 = 0
The function can only be 1 or 0 and if you compare 1 and 0, its 0. If you compare 0 and 0, its 0. So no matter what, the if statement is true, and doesn't need to be there, and I can remove it entirely with no issues. Am I right about this? :ehh:
vb Code:
If Sprite_Number = 0 And (PPU_Status And 64) = 0 Then
Now bare with me here. I converted the PPU_Status And 64 to a function which technically is checking the 7th bit of PPU_Status to see if its 1 or 0. Which is true, see this:
Code:
&H1 = 00000001 = 1
&H2 = 00000010 = 2
&H4 = 00000100 = 4
&H8 = 00001000 = 8
&H10 = 00010000 = 16
&H20 = 00100000 = 32
&H40 = 01000000 = 64
&H80 = 10000000 = 128
vb Code:
If Sprite_Number = 0 And Get_Sprite_0_Hit_Flag = 0 Then
Ok now lets look at the And statement in more detail.
And
--------
1 And 1 = 1
1 And 0 = 0
0 And 1 = 0
0 And 0 = 0
The function can only be 1 or 0 and if you compare 1 and 0, its 0. If you compare 0 and 0, its 0. So no matter what, the if statement is true, and doesn't need to be there, and I can remove it entirely with no issues. Am I right about this? :ehh: