| 1145 | } |
| 1146 | |
| 1147 | func (bc *bitmapContainer) fillArray(container []uint16) { |
| 1148 | // TODO: rewrite in assembly |
| 1149 | pos := 0 |
| 1150 | base := 0 |
| 1151 | for k := 0; k < len(bc.bitmap); k++ { |
| 1152 | bitset := bc.bitmap[k] |
| 1153 | for bitset != 0 { |
| 1154 | t := bitset & -bitset |
| 1155 | container[pos] = uint16((base + int(popcount(t-1)))) |
| 1156 | pos = pos + 1 |
| 1157 | bitset ^= t |
| 1158 | } |
| 1159 | base += 64 |
| 1160 | } |
| 1161 | } |
| 1162 | |
| 1163 | // NextSetBit returns the next set bit e.g the next int packed into the bitmaparray |
| 1164 | func (bc *bitmapContainer) NextSetBit(i uint) int { |