spf-discuss
[Top] [All Lists]

Re: mail administrator certification example

2004-07-30 10:23:45
Paul Howarth wrote:

John Keown wrote:

I did not make the rule for the notation. That are part of the
binary number system. The total space is the 32 bit octal address
space. Therefore there are certain mathematical restrictions imposed
by both the binary and octal notation. The /xx defines that as some
power of 2 a /24 is 2 to 8 power. or 256. a / 25 is 2 the 7 and etc.

No, the /xx means use the leftmost xx bits (only). That's why it's
called the "prefix length". People may choose to implement it using
multiplication and/or division operators but there's no need at all
to do so.

Implementing this using real multiplication and/or division instructions
would be a rather odd way to go about things. If you have a number in a
register, say, AX, you could divide by 4, using SHR AX,2; or multiply by 8,
using SHL AX,3 (and so forth). You could even emulate a /24 netmask, using
SHR AX,8 + SHL AX,8 for a combo (which would still be better than using real
division, as it clears out the lower 8 bits). Still, nothing beats a simple
AND, of course.

- Mark

        System Administrator Asarian-host.org

---
"If you were supposed to understand it,
we wouldn't call it code." - FedEx