internal virtual void DoPrevSetBit(BitArray a, LongBitSet b) { int aa = a.Count + Random().Next(100); long bb = aa; do { aa = a.PrevSetBit(aa-1); aa--; while ((aa >= 0) && (!a.Get(aa))) { aa--; } if (b.Length() == 0) { bb = -1; } else if (bb > b.Length() - 1) { bb = b.PrevSetBit(b.Length() - 1); } else if (bb < 1) { bb = -1; } else { bb = bb >= 1 ? b.PrevSetBit(bb - 1) : -1; } Assert.AreEqual(aa, bb); } while (aa >= 0); }