Comment on GoOn

<- View Parent
dannym@lemmy.escapebigtech.info ⁨10⁩ ⁨months⁩ ago

Definitely, tho if you store it as a u32 that is fixed magically. Because 1.2.3.4 and 1.02.003.04 both map to the same number.

What I mean by storing it as a u32 is to convert it to a number, similar to how the IP gets sent over the wire, so for v4:

octet[3] | octet[2] &lt;&lt; 8 | octet[1] &lt;&lt; 16 | octet[0] &lt;&lt; 24

or in more human terms:

(fourth octet) + (first octet * 256^3) + (second octet * 256^2) + (third octet * 256)

source
Sort:hotnewtop