Date: Tue, 31 Aug 2010 21:53:54 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 Message-ID: <4C7D5DD2.40407@FreeBSD.org> In-Reply-To: <201008311537.51825.jhb@freebsd.org> References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <201008311537.51825.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2010-08-31 21:37, John Baldwin wrote: >> - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; >> + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; >> } > > Perhaps replace '(p + 0x594 - 0x401)' with just 'PTOV(0x594)'? > > I would actually find it cleaner to remove 'p' altogether perhaps: > > return (*(u_char *)PTOV(0x401) * 128 * 1024 + > *(uint16_t *)PTOV(0x594) * 1024 * 1024); Yes, I attempted this variation at first, but it made the code bigger, which I wanted to avoid: it went from "11 bytes available" to "7 bytes" available. I tried several semantically equivalent permutations of the expression, and the one I committed gave no increase or decrease in code size. Apparently the code size produced by gcc is very sensitive to even minimal changes. For example, a lot of the PTOV() pointer dereferences should really be qualified with 'volatile', but that even causes boot2 to become too big to fit! If the 4 extra bytes are no problem, then I would be glad to change it to the above expression, though. It is certainly clearer. :)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C7D5DD2.40407>