nv50/ir: Don't crash on zero sized BitSets.
authorFrancisco Jerez <currojerez@riseup.net>
Sat, 19 Nov 2011 20:31:28 +0000 (21:31 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 14 Apr 2012 19:54:00 +0000 (21:54 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp

index 56d53b48ddd4a5dabcaed00df506632e6a0fb50a..4eaaa9602c15565c486b5e73ca7f3abfe7d6c37c 100644 (file)
@@ -219,6 +219,7 @@ bool BitSet::allocate(unsigned int nBits, bool zero)
    if (zero)
       memset(data, 0, (size + 7) / 8);
    else
+   if (nBits)
       data[(size + 31) / 32 - 1] = 0; // clear unused bits (e.g. for popCount)
 
    return data;