aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr
diff options
context:
space:
mode:
authorAlok Hota <[email protected]>2018-08-14 12:36:00 -0500
committerAlok Hota <[email protected]>2019-02-15 14:53:58 -0600
commit05e4ff33f5c717275e88844e67d0fc3dd12d9d2b (patch)
tree2f9717e0b23a452f4e3ebdcd14bee3376716f80d /src/gallium/drivers/swr
parentae400a9b113a46ef0e1224f75bbb4f0533686cec (diff)
swr/rast: Flip BitScanReverse index calculation
The intrinsic returns the number of leading zeros, not the bit number of the first nonzero, so just flip it based on the mask size Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr')
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/os.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h
index d685467906b..314d8184374 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -202,13 +202,13 @@ inline unsigned char _BitScanForward(unsigned int* Index, unsigned int Mask)
inline unsigned char _BitScanReverse(unsigned long* Index, unsigned long Mask)
{
- *Index = __builtin_clz(Mask);
+ *Index = 63 - __builtin_clz(Mask);
return (Mask != 0);
}
inline unsigned char _BitScanReverse(unsigned int* Index, unsigned int Mask)
{
- *Index = __builtin_clz(Mask);
+ *Index = 31 - __builtin_clz(Mask);
return (Mask != 0);
}