title: Testing if an integer is an uppercase ASCII letter using bit manipulation
body: <p>For an assignment, I'm trying to make some code in C that uses only bit manipulation to test if an integer is an ASCII uppercase letter. The letter will be given by its ASCII code in integer form, meaning <code>0x41 &lt;= ourint &lt;= 0x5A</code>. After doing some research I learned that the difference between a lower case and an upper case letter was the sixth digit of the binary version of the word. Uppercase had a <code>1</code> and lower had a <code>0</code>. </p>
  
  <p>I am almost have it, but my code won't work.</p>
  
  <p>What I have so far is</p>
  
  <pre><code>!(((x&gt;&gt;6)&lt;&lt;31) &amp; 0)
  </code></pre>
  
  <p>What it does is shifts the code to the right 6 to get the sixth digit as the first number, then shifts right 31 to get it to be either all 0's or 1 followed by 31 0's. I have to make it so that if it is uppercase it returns 1, so I use the exclamation point to that.</p>
  
  <p><strong>EDIT:</strong> my new code is</p>
  
  <pre><code>!((~(((x &amp; 32)&gt;&gt;5))&lt;&lt;31))&gt;&gt;31)
  </code></pre>
  
  <p>but now I am stuck on the test problem of <code>0x7fffffff</code></p>