<p>What is the best way to construct a bit mask in C with <code>m</code> set bits preceded by <code>k</code> unset bits, and followed by <code>n</code> unset bits:</p>

<pre><code>00..0 11..1 00..0
  k     m     n
</code></pre>

<p>For example, k=1, m=4, n=3 would result in the bit mask:</p>

<pre><code>01111000
</code></pre>

You can do:
```
```
~(~0 << m) << n
```
```