
renatowestphal at gmail
Mar 23, 2012, 1:56 PM
Post #5 of 23
(665 views)
Permalink
|
|
Re: [PATCH 1/2] lib: fix endianness bug in prefix.c
[In reply to]
|
|
2012/3/23 David Lamparter <equinox [at] diac24>: > On Fri, Mar 23, 2012 at 05:14:06PM -0300, Renato Westphal wrote: >> > P.S.: did patch 2/2 get lost or is the mailing list just slow? >> >> The second patch exceeded the 400 KB limit and is "waiting moderator >> approval". I'll forward it to you now. > > Thanks, I can see why. I'm not going to apply the second one; That > entire 2000-line monster is a giant WTF on its own and needs to be > replaced with something like __builtin_ffs. I'm checking the gcc > documentation for a suitable builtin. Agreed. You may also try using a 8 bits version of the mapping table: { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, 6, -1, 7, 8, }; In this case you would sum the mask length of each of the 4 bytes of a IPv4 prefix. Still pretty fast but with much less code.. > > -David > > _______________________________________________ > Quagga-dev mailing list > Quagga-dev [at] lists > http://lists.quagga.net/mailman/listinfo/quagga-dev -- Renato Westphal _______________________________________________ Quagga-dev mailing list Quagga-dev [at] lists http://lists.quagga.net/mailman/listinfo/quagga-dev
|