Doug Lowe

Networking All-in-One For Dummies


Скачать книгу

1,048,576 1MB 25 32 221 2,097,152 2MB 26 64 222 4,194,304 4MB 27 128 223 8,388,608 8MB 28 256 224 16,777,216 16MB 29 512 225 33,554,432 32MB 210 1,024 1K 226 67,108,864 64MB 211 2,048 2K 227 134,217,728 128MB 212 4,096 4K 228 268,435,456 256MB 213 8,192 8K 229 536,870,912 512MB 214 16,384 16K 230 1,073,741,824 1GB 215 32,768 32K 231 2,147,483,648 2GB 216 65,536 64K 232 4,294,967,296 4GB

      Doing the logic thing

      One of the great things about binary is that it’s very efficient at handling special operations: namely, logical operations. Four basic logical operations exist although additional operations are derived from the basic four operations. Three of the operations — AND, OR, and XOR — compare two binary digits (bits). The fourth (NOT) works on just a single bit.

      The following list summarizes the basic logical operations:

       AND: Compares two binary values. If both values are 1, the result of the AND operation is 1. If one or both of the values are 0, the result is 0.

       OR: Compares two binary values. If at least one value is 1, the result of the OR operation is 1. If both values are 0, the result is 0.

       XOR: Compares two binary values. If one of them is 1, the result is 1. If both values are 0 or if both values are 1, the result is 0.

       NOT: Doesn't compare two values but simply changes the value of a single binary value. If the original value is 1, NOT returns 0. If the original value is 0, NOT returns 1.

First Value Second Value AND OR XOR
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0

       10010100AND 11011101 10010100

      As you can see, the result is 10010100.

      Working with the binary Windows Calculator

      The Calculator program that comes with all versions of Windows has a special Programmer mode that many users don’t know about. When you flip the Calculator into this mode, you can do instant binary and decimal conversions, which can occasionally come in handy when you’re working with IP addresses.