News for hackers. Stuff that matters.
Re:4B If Statements by zeroCalories on Thursday December 28, 2023 @03:41AM (#38791360)
Why search? We know exactly where every number is. Use a jump table.

While this example is obviously silly because loading a number into a register and performimg some operations on it is going to be faster than a cache miss from jumping into a massive table, the general technique can absolutely be applied in the real world.

Re:4B If Statements by noobermin on Thursday December 28, 2023 @04:35AM (#38791701)
The thing is jump tables re absolutely used for this kind of thing, namely when the function doesn't have an easy closed form. It should be noted half of the joke is the fact he uses subsequent if statements in order to exhaustively check each number rather than a jump table.