News for hackers. Stuff that matters.
Re:Round a direction vector to an 8-way compass by WithinReason on Monday July 25, 2022 @11:02AM (#32225318)
Would else if be actually faster on a modern CPU architecture?
Re:Round a direction vector to an 8-way compass by pklausler on Monday July 25, 2022 @12:23PM (#32226634)
Only measurement with real data would tell for sure, but I would bet "yes" if I had to. With the "else", the "if" predicate is being predicted over a smaller amount of relevant cases; without the "else", the prediction is going to have to cope with some amount of needless false results and is likely to be less accurate.