Skip to content

Commit

Permalink
Fix bit-position logic in bit_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
LegionMammal978 committed May 25, 2022
1 parent 69b997e commit 8f40746
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/itsy/detail/bit_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ namespace ITSY_BITSY_SOURCE_NAMESPACE
}
__size_type __bit_advancement = __n % __binary_digits_v<__word_type>;
this->_M_pos += __bit_advancement;
if (this->_M_pos > __binary_digits_v<__word_type>)
if (this->_M_pos >= __binary_digits_v<__word_type>)
{
// put it back in the proper range
this->_M_pos -= __binary_digits_v<__word_type>;
Expand Down Expand Up @@ -897,7 +897,7 @@ namespace ITSY_BITSY_SOURCE_NAMESPACE
if (__bit_advancement > this->_M_pos)
{
// put it back in the proper range
this->_M_pos = __binary_digits_v<__word_type> - __bit_advancement;
this->_M_pos += __binary_digits_v<__word_type> - __bit_advancement;
// going forward by one extra since we
// overflow binary digit count
++__it_advancement;
Expand Down

0 comments on commit 8f40746

Please sign in to comment.