What's the best way to convert from network bitcount to netmask?

Posted by Choy on Stack Overflow See other posts from Stack Overflow or by Choy
Published on 2008-10-20T14:17:32Z Indexed on 2010/04/14 22:43 UTC
Read the original article Hit count: 311

For example, if I have a network spec like 172.20.10.0/24, "24" is the bitcount. What's the best way to convert that to a netmask like 0xffffff00 ?

© Stack Overflow or respective owner

Related posts about networking

Related posts about bit-manipulation