title: Is it faster to use a lookup table or to left/right bit-shift to obtain a power of 2 integer?
body: <p>Suppose I want to build the bit mask with the Nth bit set. I have N as an integer. </p>
  
  <p>Which is better? <code>1 &lt;&lt; N</code> or a lookup table (pointer arithmetic addition)? </p>
  
  <p>My guess is that a single bit shift operation is faster than a memory lookup, and only once cache-hot does LUT have a fighting chance. However if this is the case then why are LUT's so often the fastest solution in bit-twiddling problems? Is it simply because of the huge caches we have in our CPU's these days?</p>
  
  <p>Let me qualify the question with the fact that I care the most about this operation at this moment on x86-64. </p>