dretax/GarHal_CSGO

Another thing I noticed

itsyourcracker opened this issue · 4 comments

This isn't anything major but I thought I should point it out.

https://github.com/dretax/GarHal_CSGO/blob/1150d94123d3cd6ded7a45a8a8a46a8bb33bad8c/GarhalController/Aimbot.cpp

line 120

for (int i = 0; i < 64; i++)

you could change it to this

for (int i = 0; i <= 64; ++i)

The reason behind this: In community servers there can be 64 players ergo the less than or equal to, and the reason you would put the two pluses in front if the i is because there's one less nop.

here is an article explaining the differences between i++ and ++i
https://medium.com/better-programming/stop-using-i-in-your-loops-1f906520d548

The equal line in that case is not true. We index from 0. The 64th player is gonna be index 63.

0-0 oh my god. Wow am I brain dead

but you should still read the article

I do understand what you are trying to say, but in this case It really doesn't do a big difference. As on building on Release, the compiler is going to optimize the instructions. It's the same when using C# and building with msbuild on release, with the optimize parameter.

https://stackoverflow.com/questions/24886/is-there-a-performance-difference-between-i-and-i-in-c

In this little case the performance is probably gonna be invisible, or unnoticeable. But the change can be applied.