diff options
author | Tormod Volden <debian.tormod@gmail.com> | 2011-09-17 11:58:50 +0200 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2011-09-23 20:59:48 +0200 |
commit | ca6c41fd8c9fcb563ee5f97689806edcb0da54bf (patch) | |
tree | 410a9c7683283b7110a738113e13905e1acbe698 /src | |
parent | f27eac4b3fe9e6f13d3c54711488ebe7280f24dd (diff) |
savage: Avoid unnecessary float calculation in video display
There is no reason to do the division using floats as long as
the result is an integer and there is no risk of intermediate
overflow.
This is in the code for "Old" chipsets. Integer division was already
used in the parallel code for "New" chipsets.
Also fixed up the whitespace in both blocks.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/savage_video.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/savage_video.c b/src/savage_video.c index 7d571ad..5f08a18 100644 --- a/src/savage_video.c +++ b/src/savage_video.c @@ -1503,16 +1503,15 @@ SavageDisplayVideoOld( } 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; + dstBox->x1 = (dstBox->x1 * psav->XExp1) / psav->XExp2; + dstBox->y1 = (dstBox->y1 * psav->YExp1) / psav->YExp2; dstBox->x2 = (dstBox->x2 * psav->XExp1) / psav->XExp2; dstBox->y2 = (dstBox->y2 * psav->YExp1) / psav->YExp2; - - dstBox->x1 += psav->displayXoffset; - dstBox->y1 += psav->displayYoffset; + dstBox->x1 += psav->displayXoffset; + dstBox->y1 += psav->displayYoffset; dstBox->x2 += psav->displayXoffset; dstBox->y2 += psav->displayYoffset; } @@ -1668,10 +1667,10 @@ SavageDisplayVideoNew( !psav->CrtOnly && !psav->TvOn) { - drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1; - drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1; - dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2; - dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2; + drw_w = (drw_w * psav->XExp1) / psav->XExp2 + 1; + drw_h = (drw_h * psav->YExp1) / psav->YExp2 + 1; + dstBox->x1 = (dstBox->x1 * psav->XExp1) / psav->XExp2; + dstBox->y1 = (dstBox->y1 * psav->YExp1) / psav->YExp2; dstBox->x2 = (dstBox->x2 * psav->XExp1) / psav->XExp2; dstBox->y2 = (dstBox->y2 * psav->YExp1) / psav->YExp2; dstBox->x1 += psav->displayXoffset; |