[PATCH] savage: Avoid unnecessary float calculation in video display
Tormod Volden
lists.tormod at gmail.com
Sat Sep 17 04:28:43 PDT 2011
On Sat, Sep 17, 2011 at 1:03 PM, walter harms wrote:
>> if (S3_MOBILE_TWISTER_SERIES(psav->Chipset)
>> - && psav->FPExpansion) {
>> - drw_w = (((float)(drw_w * psav->XExp1)/(float)psav->XExp2)+1);
>> - drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2+1;
>> - dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2;
>> - dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2;
>> + && psav->FPExpansion) {
>> + drw_w = (drw_w * psav->XExp1) / psav->XExp2 + 1;
>> + drw_h = (drw_h * psav->YExp1) / psav->YExp2 + 1;
>
> to improve readability i would suggest a writing like this:
>
> scale= psav->XExp1/psav->XExp2;
> drw_w = 1+ drw_w *scale ;
> drw_h = 1+ drw_h *scale ;
Hi Walter,
Thanks for your review and comments. Note that the scale is different
for x and y so it would need two scale variables in your example. I
don't want to put too much effort into beautifying the code, just make
the "Old" and "New" chipset code path match.
>
> the price of float is small these days ...
This driver is not for today's hardware :) Yes, I guess there is no
visible performance win, but it makes the code more consistent and
readable.
Cheers,
Tormod
More information about the xorg-devel
mailing list