| 83 | }; |
| 84 | |
| 85 | int Bitmap256::FindNextSetBit(int c) const { |
| 86 | DCHECK_GE(c, 0); |
| 87 | DCHECK_LE(c, 255); |
| 88 | |
| 89 | // Check the word that contains the bit. Mask out any lower bits. |
| 90 | int i = c / 64; |
| 91 | uint64_t word = words_[i] & (~uint64_t{0} << (c % 64)); |
| 92 | if (word != 0) |
| 93 | return (i * 64) + FindLSBSet(word); |
| 94 | |
| 95 | // Check any following words. |
| 96 | i++; |
| 97 | switch (i) { |
| 98 | case 1: |
| 99 | if (words_[1] != 0) |
| 100 | return (1 * 64) + FindLSBSet(words_[1]); |
| 101 | FALLTHROUGH_INTENDED; |
| 102 | case 2: |
| 103 | if (words_[2] != 0) |
| 104 | return (2 * 64) + FindLSBSet(words_[2]); |
| 105 | FALLTHROUGH_INTENDED; |
| 106 | case 3: |
| 107 | if (words_[3] != 0) |
| 108 | return (3 * 64) + FindLSBSet(words_[3]); |
| 109 | FALLTHROUGH_INTENDED; |
| 110 | default: |
| 111 | return -1; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | } // namespace re2 |
| 116 |
no test coverage detected