Date: Tue, 10 Aug 2010 19:47:24 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: "M. Warner Losh" <imp@bsdimp.com> Cc: src-committers@FreeBSD.org, jilles@stack.nl, svn-src-all@FreeBSD.org, olli@fromme.com, olli@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r211023 - head/usr.sbin/syslogd Message-ID: <86sk2m1hsj.fsf@ds4.des.no> In-Reply-To: <20100810.110642.335141733495090585.imp@bsdimp.com> (M. Warner Losh's message of "Tue, 10 Aug 2010 11:06:42 -0600 (MDT)") References: <20100810.093656.167578749323544001.imp@bsdimp.com> <201008101623.o7AGNs7I042679@haluter.fromme.com> <20100810.110642.335141733495090585.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"M. Warner Losh" <imp@bsdimp.com> writes: > /* > * Macros to cast a struct sockaddr, or parts thereof. > * On architectures with strict alignment requirements, the compiler > * can bogusly warn about alignment problems since its static analysis > * is insufficient for it to know that with the APIs used, there > * really is no alignment issue. > */ That's a bit harsh on the compiler, don't you think? It never pays to hurt the compiler's feelings :) > : @@ -2410,8 +2419,8 @@ > : } > : reject =3D 0; > : for (j =3D 0; j < 16; j +=3D 4) { > : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m= 6p->sin6_addr.s6_addr[j]) > : - !=3D *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) { > : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->s= in6_addr.s6_addr[j])) > : + !=3D UINT32_CAST(a6p->sin6_addr.s6_addr[j])) { > : ++reject; > : break; > : } > :=20 > :=20 > > Why 16 and 4 here? What's so magical about them? 4 =3D bytes in a uint32_t, 16 =3D bytes in an ipv6 address. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86sk2m1hsj.fsf>