title: C Macro to Test Set Bits in Range
body: <p>How would one go about writing a macro in C that checks if any bits of a long are set within a range? If all the bits of a long are set within a range?</p>
  
  <p>Could you do something like</p>
  
  <pre><code>#define TEST_ALL(number, high, low)    (1 &amp; (number &lt;&lt; low))
  </code></pre>
  
  <p>But that would only check the lowest bit. I understand you could do a for loop and just keep incrementing from low until you get to high checking bit by bit, but I'm wondering if there is a simpler solution with a macro that would be just as effective.</p>