Created
March 4, 2013 19:01
-
-
Save djk29a/5084533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> for(masked <- 0 until 8) { println("Bits: 0xff & masked bits (" + masked + ") => " + (256 - (255 & (1 << masked)))) } | |
Bits: 0xff & masked bits (0) => 255 | |
Bits: 0xff & masked bits (1) => 254 | |
Bits: 0xff & masked bits (2) => 252 | |
Bits: 0xff & masked bits (3) => 248 | |
Bits: 0xff & masked bits (4) => 240 | |
Bits: 0xff & masked bits (5) => 224 | |
Bits: 0xff & masked bits (6) => 192 | |
Bits: 0xff & masked bits (7) => 128 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just wanted a quick reference for reminding myself how easy IPv4 subnet masking is when it's 3 am and I'm beating my head on trivial networking problems that shouldn't be that hard when I'm being sane.