Index mapping: Difference between revisions

Content deleted Content added
C example 1: rewrite example
link and section header
Line 21:
The following two examples demonstrate how a simple non-iterative table lookup, using a trivial hash function, can eliminate conditional testing & branching completely thereby reducing [[instruction path length]] significantly. Although both examples are shown here as functions, the required code would be better [[Inline expansion|inlined]] to avoid function call overhead in view of their obvious simplicity.
 
===CAvoid example 1branching===
Roger Sayle gives an example<ref>{{cite journal|last1=Sayle|first1=Roger Anthony|title=A Superoptimizer Analysis of Multiway Branch Code Generation|journal=Proceedings of the GCC Developers’ Summit|date=June 17, 2008|pages=103-116|url=https://www.nextmovesoftware.com/technology/SwitchOptimization.pdf|accessdate=26 November 2015}}</ref> of eliminating a [[multiway branch]] caused by a switch statement:
 
<source lang="c++">
Line 58:
* [[Hash table]]
* [[Lookup table]]
* [[Multiway branch]]
 
==References==