title: Efficient way to test if bitwise IPv6 netmask is contiguous
body: <p>I need to store IP addresses/netmasks in an in_addr/in6_addr struct.
  For IPv4 I use the following code to test if the netmask is contiguous:</p>
  
  <pre><code>((((~netmask + 1) &amp; (~netmask)) != 0)  &amp;&amp; (netmask != 0))
  </code></pre>
  
  <p>I was wondering if there is a smart way to do the same for IPv6.</p>