From: Matthew Fernandez Date: Fri, 11 Feb 2022 10:40:22 +0000 (+1100) Subject: fix incorrect clearing of bits in bitarray X-Git-Tag: 3.0.0~31^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b945c57b1d8148c7c736271c8c5f8b8c796fce9;p=graphviz fix incorrect clearing of bits in bitarray The wrong bitwise operations were used here, resulting in e.g. a set of bit 2 of of `0b011000` updating to `0b011100` instead of being a no-op. This bug was present since the first introduction of this interface in 3ced90bd756bb8e56920620f2686e0ba6b482bbb, but this has not yet made it into a release. --- diff --git a/lib/cgraph/bitarray.h b/lib/cgraph/bitarray.h index bf9564275..6aa7fb7d7 100644 --- a/lib/cgraph/bitarray.h +++ b/lib/cgraph/bitarray.h @@ -113,7 +113,7 @@ static inline void bitarray_set(bitarray_t *self, size_t index, bool value) { if (value) { base[index / 8] |= (uint8_t)(UINT8_C(1) << (index % 8)); } else { - base[index / 8] ^= (uint8_t)(UINT8_C(1) << (index % 8)); + base[index / 8] &= (uint8_t)~(UINT8_C(1) << (index % 8)); } } diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 7f203084c..01128fa9f 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1516,7 +1516,6 @@ def test_gvmap_fclose(): # pass this through gvmap subprocess.run(["gvmap"], input=input.encode("utf-8"), check=True) -@pytest.mark.xfail(strict=True) # FIXME def test_bitarray(): """run the bitarray unit tests"""