diff options
author | Alok Hota <[email protected]> | 2018-08-14 12:36:00 -0500 |
---|---|---|
committer | Alok Hota <[email protected]> | 2019-02-15 14:53:58 -0600 |
commit | 05e4ff33f5c717275e88844e67d0fc3dd12d9d2b (patch) | |
tree | 2f9717e0b23a452f4e3ebdcd14bee3376716f80d /src/gallium/drivers/swr | |
parent | ae400a9b113a46ef0e1224f75bbb4f0533686cec (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.h | 4 |
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); } |