On Wed, 11.03.15 08:13, Shawn Landden (sh...@churchofgit.com) wrote:

> We shouldn't assume 64-bit arch with the way we do math either.
> (although I will submit a patch to glibc to add a uint64_t union
> alias)

Hmm? uint64_t works fine on 32bit too. The compiler can do the
necessary emulation on its own... I don't see the need to change
anything here.

> diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
> index 0be6165..4b7f451 100644
> --- a/src/network/networkd-address.c
> +++ b/src/network/networkd-address.c
> @@ -605,12 +605,12 @@ bool address_equal(Address *a1, Address *a2) {
>                  }
>  
>          case AF_INET6: {
> -                uint64_t *b1, *b2;
> +                uint32_t *b1, *b2;
>  
> -                b1 = (uint64_t*)&a1->in_addr.in6;
> -                b2 = (uint64_t*)&a2->in_addr.in6;
> +                b1 = &a1->in_addr.in6.s6_addr32[0];
> +                b2 = &a2->in_addr.in6.s6_addr32[0];
>  
> -                return (((b1[0] ^ b2[0]) | (b1[1] ^ b2[1])) == 0UL);
> +                return (((b1[0] ^ b2[0]) | (b1[1] ^ b2[1]) | (b1[2] ^ b2[2]) 
> | (b1[3] ^  b2[3])) == 0);
>          }
>  
>          default:
> -- 
> 2.2.1.209.g41e5f3a
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to