Thanks! Doh, obvious in hindsight. > On Jun 15, 2018, at 11:05 AM, Martin Buchholz <marti...@google.com> wrote: > > It took me a while to realize why you were checking tz < 63. It's because > the shift by 64 that might occur below would be a no-op!
Right! > 1301 action.accept(i++); > 1302 word &= (WORD_MASK << i); > Can we rewrite to simply flip the one bit via > > word &= ~(1L << i); > action.accept(i++); > > and then we can simplify the tz handling? > Yes, and there is no need to increment i: http://cr.openjdk.java.net/~psandoz/jdk/JDK-8170159-bitset-traverse/webrev/src/java.base/share/classes/java/util/BitSet.java.sdiff.html <http://cr.openjdk.java.net/~psandoz/jdk/JDK-8170159-bitset-traverse/webrev/src/java.base/share/classes/java/util/BitSet.java.sdiff.html> Paul.