▲ | mastermage 10 days ago | ||||||||||||||||||||||||||||||||||||||||
sometimes you do some wack magic in just one line of code, sometimes thats necessary for performance or because what you are trying todo is inherently wack magic. Example the fast inverse square from quake. Insane magic and if you just document does inverse square approximately people would freak out. So sometimes when wack magic is used explain the wack magic (as concise as reasonable) | |||||||||||||||||||||||||||||||||||||||||
▲ | marginalia_nu 10 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||
Yup. I've got a function the gist of which is
This looks like it could be simplified as
But if you do you lose out on 20% of performance due to branch mispredictions, and this is a very hot function. It looks like a mistake, like the two are equivalent, but they are actually not. So it gets a comment that explains what's happening. | |||||||||||||||||||||||||||||||||||||||||
|