3 ms·
Small system aren't always simple or easy to understand. Famous code examples are Duff's Device [1] or the "wtf" fast inverse square root function [2]. Both fun
by xg15 4y ago
Small system aren't always simple or easy to understand. Famous code examples are Duff's Device [1] or the "wtf" fast inverse square root function [2]. Both functions are just a few lines long but usually leave people scratching their heads until they learn about the trick.
Especially with Demoscene code, it's common to exploit all kinds of specific hardware effects or re-parse the assembly code to a different instruction sequence [3]. This kind of stuff may be a lot more complex than a larger system, it just hides its complexity in a compressed representation.
[1] https://en.wikipedia.org/wiki/Duff%27s_device https://en.wikipedia.org/wiki/Duff%27s_device
[2] https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overv...
[3] https://reverseengineering.stackexchange.com/questions/20587/jump-in-the-middle-trick https://reverseengineering.stackexchange.com/questions/20587...