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 = 0;
> : for (j = 0; j < 16; j += 4) {
> : - if ((*(u_int32_t *)&sin6->sin6_addr.s6_addr[j] & *(u_int32_t *)&m6p->sin6_addr.s6_addr[j])
> : - != *(u_int32_t *)&a6p->sin6_addr.s6_addr[j]) {
> : + if ((UINT32_CAST(sin6->sin6_addr.s6_addr[j]) & UINT32_CAST(m6p->sin6_addr.s6_addr[j]))
> : + != UINT32_CAST(a6p->sin6_addr.s6_addr[j])) {
> : ++reject;
> : break;
> : }
> :
> :
>
> Why 16 and 4 here? What's so magical about them?
4 = bytes in a uint32_t, 16 = bytes in an ipv6 address.
DES
--
Dag-Erling Smørgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86sk2m1hsj.fsf>
