Mesa (master): nv50/ir: properly clear upper bits of a bitset fill

Ilia Mirkin imirkin at kemper.freedesktop.org
Wed Aug 17 01:58:05 UTC 2016


Module: Mesa
Branch: master
Commit: 0b5f40b881d149d6c960d4ff8f69b58596cf9660
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b5f40b881d149d6c960d4ff8f69b58596cf9660

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sat Aug 13 15:45:35 2016 -0400

nv50/ir: properly clear upper bits of a bitset fill

Found by inspection. In practice, val is always == 0, so this never got
triggered.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp
index 682c569..1daf778 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp
@@ -297,8 +297,8 @@ void BitSet::fill(uint32_t val)
    unsigned int i;
    for (i = 0; i < (size + 31) / 32; ++i)
       data[i] = val;
-   if (val)
-      data[i] &= ~(0xffffffff << (size % 32)); // BE ?
+   if (val && i)
+      data[i - 1] &= (1 << (size % 32)) - 1;
 }
 
 void BitSet::setOr(BitSet *pA, BitSet *pB)




More information about the mesa-commit mailing list