| 242 | } |
| 243 | |
| 244 | void DecodedVector::fillInIndices() { |
| 245 | if (isConstantMapping_) { |
| 246 | if (size_ > zeroIndices().size() || constantIndex_ != 0) { |
| 247 | copiedIndices_.resize(size_); |
| 248 | std::fill(copiedIndices_.begin(), copiedIndices_.end(), constantIndex_); |
| 249 | indices_ = copiedIndices_.data(); |
| 250 | } else { |
| 251 | indices_ = zeroIndices().data(); |
| 252 | } |
| 253 | return; |
| 254 | } |
| 255 | if (isIdentityMapping_) { |
| 256 | if (size_ > consecutiveIndices().size()) { |
| 257 | copiedIndices_.resize(size_); |
| 258 | std::iota(copiedIndices_.begin(), copiedIndices_.end(), 0); |
| 259 | indices_ = &copiedIndices_[0]; |
| 260 | } else { |
| 261 | indices_ = consecutiveIndices().data(); |
| 262 | } |
| 263 | return; |
| 264 | } |
| 265 | BOLT_FAIL( |
| 266 | "DecodedVector::indices_ must be set for non-constant non-consecutive mapping."); |
| 267 | } |
| 268 | |
| 269 | void DecodedVector::makeIndicesMutable() { |
| 270 | if (indicesNotCopied()) { |