Commit 7a18d752 by Richard Biener Committed by Richard Biener

bitmap.h: Document constraints on bitmap modification while iterating over it.

2016-10-07  Richard Biener  <rguenther@suse.de>

	* bitmap.h: Document constraints on bitmap modification while
	iterating over it.

From-SVN: r240860
parent a30fe4b6
2016-10-07 Richard Biener <rguenther@suse.de> 2016-10-07 Richard Biener <rguenther@suse.de>
* bitmap.h: Document constraints on bitmap modification while
iterating over it.
2016-10-07 Richard Biener <rguenther@suse.de>
* bitmap.c (bitmap_elem_to_freelist): Set indx to -1. * bitmap.c (bitmap_elem_to_freelist): Set indx to -1.
* bitmap.h (bmp_iter_set): When advancing to the next element * bitmap.h (bmp_iter_set): When advancing to the next element
check that we didn't remove the current one. check that we didn't remove the current one.
......
...@@ -755,6 +755,18 @@ bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no) ...@@ -755,6 +755,18 @@ bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no)
} }
} }
/* If you are modifying a bitmap you are currently iterating over you
have to ensure to
- never remove the current bit;
- if you set or clear a bit before the current bit this operation
will not affect the set of bits you are visiting during the iteration;
- if you set or clear a bit after the current bit it is unspecified
whether that affects the set of bits you are visiting during the
iteration.
If you want to remove the current bit you can delay this to the next
iteration (and after the iteration in case the last iteration is
affected). */
/* Loop over all bits set in BITMAP, starting with MIN and setting /* Loop over all bits set in BITMAP, starting with MIN and setting
BITNUM to the bit number. ITER is a bitmap iterator. BITNUM BITNUM to the bit number. ITER is a bitmap iterator. BITNUM
should be treated as a read-only variable as it contains loop should be treated as a read-only variable as it contains loop
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment