| 133 | } |
| 134 | |
| 135 | S32 TSIntegerSet::end() const |
| 136 | { |
| 137 | for (S32 i=MAX_TS_SET_DWORDS-1; i>=0; i--) |
| 138 | { |
| 139 | // search for set bit one dword at a time |
| 140 | U32 dword = bits[i]; |
| 141 | if (bits[i]) |
| 142 | { |
| 143 | // got dword, now search one byte at a time |
| 144 | S32 j = 31; |
| 145 | U32 mask = 0xFF000000; |
| 146 | do |
| 147 | { |
| 148 | if (dword&mask) |
| 149 | { |
| 150 | // got byte, now one bit at a time |
| 151 | U32 bit = mask & ~(mask>>1); // grabs the highest bit |
| 152 | do |
| 153 | { |
| 154 | if (dword&bit) |
| 155 | return (i<<5)+j+1; |
| 156 | j--; |
| 157 | bit >>= 1; |
| 158 | } while (1); |
| 159 | } |
| 160 | mask >>= 8; |
| 161 | j -= 8; |
| 162 | } while (1); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 169 | void TSIntegerSet::next(S32 & i) const |
| 170 | { |
no outgoing calls
no test coverage detected