title: How do those bitmasks actually work?
body: <p>For example, this method from NSCalendar takes a bitmask:</p>
  
  <pre><code>- (NSDate *)dateByAddingComponents:(NSDateComponents *)comps toDate:(NSDate *)date options:(NSUInteger)opts
  </code></pre>
  
  <p>So options can be like:</p>
  
  <pre><code>NSUInteger options = kCFCalendarUnitYear;
  </code></pre>
  
  <p>or like:</p>
  
  <pre><code>NSUInteger options = kCFCalendarUnitYear | kCFCalendarUnitMonth | kCFCalendarUnitDay;
  </code></pre>
  
  <p>What I don't get is, how is this actually done? I mean: How can they pull out those values which are merged into <code>options</code>? If I wanted to program something like this, that can take a bitmask, how would that look?</p>