From: Trevor Saunders <tbsaunde+...@tbsaunde.org> This make the sbitmap version return true if the bit was previously unset to make it similar to the bitmap version.
gcc/ChangeLog: 2017-05-09 Trevor Saunders <tbsaunde+...@tbsaunde.org> * sbitmap.h (bitmap_set_bit): Return bool similar to bitmap version of this function. --- gcc/sbitmap.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h index cba0452cdb9..d4e3177d495 100644 --- a/gcc/sbitmap.h +++ b/gcc/sbitmap.h @@ -108,11 +108,14 @@ bitmap_bit_p (const_sbitmap map, int bitno) /* Set bit number BITNO in the sbitmap MAP. */ -static inline void +static inline bool bitmap_set_bit (sbitmap map, int bitno) { - map->elms[bitno / SBITMAP_ELT_BITS] - |= (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS; + SBITMAP_ELT_TYPE &word = map->elms[bitno / SBITMAP_ELT_BITS]; + SBITMAP_ELT_TYPE mask = (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS; + bool ret = (word & mask) == 0; + word |= mask; + return ret; } /* Reset bit number BITNO in the sbitmap MAP. */ -- 2.11.0