Hi,

On Wed, Aug 10, 2011 at 03:47:36PM +0200, Gisle Vanem wrote:
> "Heiko Hund" <heiko.h...@sophos.com> wrote:
> 
> > +#ifndef IN6_ARE_ADDR_EQUAL
> > +#define IN6_ARE_ADDR_EQUAL(a,b) \
> > +    ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
> > +  && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
> > +  && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
> > +  && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
> > +#endif
> 
> A little more readable:
>   #define IN6_ARE_ADDR_EQUAL(a, b)   \
>               (!memcmp ((const void*)(a), (const void*)(b), sizeof (struct 
> in6_addr)))

... and guaranteed to be safe regarding alignment... so I like the second
one better.

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             g...@greenie.muc.de
fax: +49-89-35655025                        g...@net.informatik.tu-muenchen.de

Attachment: pgpWUIvWsy5rE.pgp
Description: PGP signature

Reply via email to