The invention relates to a method of routing or compressing packets
destination address through an electronic routing or compressing device,
the packets destination address being n bit packets and having address
indicative of a desired destination, the address being classless, the
routing device having at least a data base of prefix entries, each of
which containing entries corresponding to a desired output data link, the
method having the steps of: a) generating an address mask until an entry
matching a masked address obtained by making an AND operation between the
packets destination address and the address mask, is found in the data;
the address mask having a number of bit equal to that of the packets
destination address and having, starting from the most significant n-bit
equal to 1 and the remaining i bit equal to 0, with 0<=u<=b.1, with
the first generated mask having i=0 or i=1, b) if a match is found,
stopping the generation of masked address and outputting the output data
link corresponding to the match, c) if no match is found, outputting a
message indicating that no output data link was found.