title: how to mask out 'upper half' of long int
body: <p>I have a question about constructing bitmasks in C.  I need to mask out the least-significant half of a 'long int', so that I am left with only the upper half.  I need to ensure that it masks out <i>half</i> no matter if I am on a 64-bit or 32-bit platform.  I see that __WORD_SIZE is defined in limits.h.  Initially I am doing it like this:</p>
  
  <pre><code>#define UPPER(X) ( X &amp; ( ~0 &lt;&lt; (__WORDSIZE/2) ) )
  </code></pre>
  
  <p>what is the most correct and efficient way to do it?</p>