4 ms·
Here is the famed "Fast Inverse Square Root" trick: https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/game/q_ma
by ddtaylor 8y ago
Here is the famed "Fast Inverse Square Root" trick:
https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb10315479fc00086f08e25d968b4b43c49/code/game/q_math.c#L561 https://github.com/id-Software/Quake-III-Arena/blob/dbe4ddb1...
https://en.wikipedia.org/wiki/Fast_inverse_square_root https://en.wikipedia.org/wiki/Fast_inverse_square_root
- kchr 8y agoThanks for lifting this up!
- philbarr 8y agoMy favourite part of the wiki page is: i = 0x5f3759df - ( i >> 1 ); // what the fuck?
- ddtaylor 8y agoI like how they rewrite the code in different ways (type punning) and keep the "what the fuck?" comment intact.
- toolslive 8y agoThat trick was published in Graphics Gems V (1995) by Ken Turkowski.
- Someone1234 8y agoIt seems to pre-date that: https://en.wikipedia.org/wiki/Fast_inverse_square_root#History_and_investigation https://en.wikipedia.org/wiki/Fast_inverse_square_root#Histo...