title: Bit manipulations good practices
body: <p>As a beginner C programmer, I am wondering, what would be the best easy-to-read and easy-to-understand solution for setting control bits in a device. Are there any <em>standards</em>? Any example code to mimic? Google didn't give any reliable answer.</p>
  
  <p>For example, I have a control block map:
  <a href="https://i.stack.imgur.com/igVjV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/igVjV.png" alt="map"></a></p>
  
  <p>The first way I see would be to simply set the needed bits. It requires a bunch of explanations in comments and seems to be not all that professional.</p>
  
  <pre><code>DMA_base_ptr[DMA_CONTROL_OFFS] = 0b10001100;
  </code></pre>
  
  <p>The second way I see is to create a bit field. I'm not sure if this is the one should I stick to, since I never encountered it being used in such way (unlike the first option I mentioned).</p>
  
  <pre><code>struct DMA_control_block_struct
  { 
      unsigned int BYTE:1; 
      unsigned int HW:1; 
      // etc
  } DMA_control_block_struct;
  </code></pre>
  
  <p>Is one of the options better than the other one? Are there any options I just don't see?</p>
  
  <p>Any advice would be highly appreciated </p>