[PATCH 1/3] lib: Add ip6_common_octets function

Ondrej Zajicek santiago at crfreenet.org
Tue Jun 6 14:33:33 CEST 2017


On Tue, Jun 06, 2017 at 01:00:38PM +0200, Toke Høiland-Jørgensen wrote:
> Christian Tacke <Christian.Tacke+bird.network.cz at cosmokey.com> writes:
> 
> > Hi,
> >
> > just out of curiosity:
> >
> > On Mon, Jun 05, 2017 at 23:49:52 +0200, Toke Høiland-Jørgensen wrote:
> > [...]
> >> +int
> >> +ip6_common_octets(ip6_addr a, ip6_addr b)
> >> +{
> >> +  int i, j, common = 0;
> > [...]
> >
> > Why aren't you using an unsigned int here?
> 
> No particular reason; I suppose muscle memory kicked in and gave me an
> 'int'. You are right, of course, that it should probably be uint... :)

Well, beware of down-iteration in for():

  for (j=3; j>=0; j--)

That would not work with uint.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170606/4ba59f5a/attachment.asc>


More information about the Bird-users mailing list