The BitMap::count_one_bits operation sums the population count of each word in the bitmap, including the last, which might only be partial. If there are set bits beyond that designated by BitMap::size() then the returned count will be wrong.
Some BitMaps guarantee that the allocated buffer is initially cleared, in which case there won't be any set bits beyond the end. But a BitMapView can be made from some arbitrary buffer, perhaps even a subpart of some other BitMap, where no such guarantee exists.
Some BitMaps guarantee that the allocated buffer is initially cleared, in which case there won't be any set bits beyond the end. But a BitMapView can be made from some arbitrary buffer, perhaps even a subpart of some other BitMap, where no such guarantee exists.
- relates to
-
JDK-8235551 BitMap::count_one_bits should use population_count
-
- Resolved
-
-
JDK-8241581 Add BitMap::count_one_bits variant for arbitrary lengths
-
- Resolved
-
-
JDK-8235715 BitMap::count_one_bits could be faster
-
- Closed
-
-
JDK-8155043 BitMap set operations assume clear bits beyond unaligned end
-
- Resolved
-