svn commit: r212064 - head/sys/boot/pc98/boot2
Dimitry Andric
dim at FreeBSD.org
Tue Aug 31 19:54:01 UTC 2010
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. :)
More information about the svn-src-all
mailing list