Date: Tue, 27 Jan 2009 21:50:37 +0100 From: Luigi Rizzo <rizzo@iet.unipi.it> To: Max Laier <max@love2party.net> Cc: svn-src-head@freebsd.org, Luigi Rizzo <luigi@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r187787 - head/sbin/ipfw Message-ID: <20090127205037.GA35494@onelab2.iet.unipi.it> In-Reply-To: <200901272136.39409.max@love2party.net> References: <200901272026.n0RKQjq3095984@svn.freebsd.org> <200901272136.39409.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 27, 2009 at 09:36:38PM +0100, Max Laier wrote: > On Tuesday 27 January 2009 21:26:45 Luigi Rizzo wrote: ... > > Modified: head/sbin/ipfw/ipfw2.c > > =========================================================================== > > --- head/sbin/ipfw/ipfw2.c Tue Jan 27 20:25:55 2009 (r187786) > > +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 20:26:45 2009 (r187787) > > @@ -306,8 +306,18 @@ static struct _s_x rule_options[] = { > > { NULL, 0 } /* terminator */ > > }; > > > > -static __inline uint64_t > > -align_uint64(uint64_t *pll) { > > +/* > > + * The following is used to generate a printable argument for > > + * 64-bit numbers, irrespective of platform alignment and bit size. > > + * Because all the printf in this program use %llu as a format, > > + * we just return an unsigned long long, which is larger than > > + * we need in certain cases, but saves the hassle of using > > + * PRIu64 as a format specifier. > > + * We don't care about inlining, this is not performance critical code. > > + */ > > You can always use uintmax_t and print with %ju instead. I'm also not sure > that you really need this. None of the structures that hold the 64bit values > are packed and thus should be correctly aligned. A simple cast to uintmax_t > should be sufficient. maybe -- but some of the align_uint64() were already there, and i did not feel like changing the code without a real chance to test it on a machine with alignment issues. as you can see the format was often bogus, partly for historical reasons (some fields changed from 32 to long to 64 bit over time, and signed/unsigned was sometimes wrong). I first want to finish the partitioning the code, and then will look at other details. cheers luigi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090127205037.GA35494>