title: How to efficiently check against bitmask?
body: <p>I am using inotify and want to efficiently check against the reported bitmask event (see <a href="http://linux.die.net/man/7/inotify" rel="noreferrer">inotify man page</a>).</p>
  
  <p>Now I could brutely check against every bit on every event, but that would be extremely crude, if not stupid, as I would have N conditionals every time. Or is calling</p>
  
  <pre><code>( bitmask &amp; mask ) == mask
  </code></pre>
  
  <p>for <strong>each</strong> mask already super efficient?</p>
  
  <p>Since the resulting bitmask is basically just a well defined number, I should be able to use basic arithmetic operations for this. But before I think up something myself, I wanted to ask if there is a well-known, efficient way to check against a given bitmask. So, is there?</p>