Index mapping: Difference between revisions

Content deleted Content added
m Applicable arrays: Typo fixing, typos fixed: eg. → e.g. using AWB
Line 18:
This example<ref>[http://ols.fedoraproject.org/GCC/Reprints-2008/sayle-reprint.pdf "A Superoptimizer Analysis of Multiway Branch Code Generation"] by Roger Anthony Sayle</ref> of a C function – returning TRUE if a month (x) contains 30 days (otherwise FALSE), illustrates the concept succinctly
<source lang="c">
if ((unsigned)x > 1112) return 0; /*x>12?*/
static const int T[12] ={0,0,0,0,1,0,1,0,0,1,0,1,0}; /* 0-based table 'if 30 days =1,else 0' */
return T[x]; /* return with boolean 1 = true, 0=false */
</source>