diff options
author | Albert Astals Cid <[email protected]> | 2020-02-26 23:05:51 +0100 |
---|---|---|
committer | Albert Astals Cid <[email protected]> | 2020-04-18 19:55:45 +0000 |
commit | 06c5875fd6b8fa387a103bd0c6fad4fa5ef847a5 (patch) | |
tree | 0c8f53e84198b1e808e9aef4100a47996d721665 /src/gallium/drivers/llvmpipe/lp_setup_line.c | |
parent | 94cb129d514b748db1342c6208ae4b7390bd33da (diff) |
Fix promotion of floats to doubles
Use the f variants of the math functions if the input parameter is a
float, saves converting from float to double and running the double
variant of the math function for gaining no precision at all
Reviewed-by: Matt Turner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3969>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup_line.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_line.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c index 3a7212326e3..1357d026dfe 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_line.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c @@ -361,10 +361,10 @@ try_setup_line( struct lp_setup_context *setup, if (fabsf(dx) >= fabsf(dy)) { float dydx = dy / dx; - x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; - y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; - x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; - y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; + x1diff = v1[0][0] - floorf(v1[0][0]) - 0.5f; + y1diff = v1[0][1] - floorf(v1[0][1]) - 0.5f; + x2diff = v2[0][0] - floorf(v2[0][0]) - 0.5f; + y2diff = v2[0][1] - floorf(v2[0][1]) - 0.5f; if (y2diff==-0.5 && dy<0){ y2diff = 0.5; @@ -459,10 +459,10 @@ try_setup_line( struct lp_setup_context *setup, const float dxdy = dx / dy; /* Y-MAJOR LINE */ - x1diff = v1[0][0] - (float) floor(v1[0][0]) - 0.5; - y1diff = v1[0][1] - (float) floor(v1[0][1]) - 0.5; - x2diff = v2[0][0] - (float) floor(v2[0][0]) - 0.5; - y2diff = v2[0][1] - (float) floor(v2[0][1]) - 0.5; + x1diff = v1[0][0] - floorf(v1[0][0]) - 0.5f; + y1diff = v1[0][1] - floorf(v1[0][1]) - 0.5f; + x2diff = v2[0][0] - floorf(v2[0][0]) - 0.5f; + y2diff = v2[0][1] - floorf(v2[0][1]) - 0.5f; if (x2diff==-0.5 && dx<0) { x2diff = 0.5; |