title: Swap two bits with a single operation in C?
body: <p>Let's say I have a byte with six unknown values:</p>
  
  <pre><code>???1?0??
  </code></pre>
  
  <p>and I want to swap bits 2 and 4 (<em>without</em> changing any of the <code>?</code> values):</p>
  
  <pre><code>???0?1??
  </code></pre>
  
  <p>But how would I do this in <strong>one operation</strong> in C?</p>
  
  <p>I'm performing this operation thousands of times per second on a microcontroller so performance is the top priority.</p>
  
  <p>It would be fine to "toggle" these bits. Even though this is not the same as swapping the bits, toggling would work fine for my purposes.</p>