mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AutoDiff upstream] NFC: update IndexSubset print/dump utilities. (#27775)
Cherry-pick #27772 from tensorflow branch.
This commit is contained in:
@@ -79,6 +79,20 @@ IndexSubset *IndexSubset::extendingCapacity(
|
||||
return IndexSubset::get(ctx, indices);
|
||||
}
|
||||
|
||||
void IndexSubset::print(llvm::raw_ostream &s) const {
|
||||
s << '{';
|
||||
interleave(range(capacity), [this, &s](unsigned i) { s << contains(i); },
|
||||
[&s] { s << ", "; });
|
||||
s << '}';
|
||||
}
|
||||
|
||||
void IndexSubset::dump(llvm::raw_ostream &s) const {
|
||||
s << "(index_subset capacity=" << capacity << " indices=(";
|
||||
interleave(getIndices(), [&s](unsigned i) { s << i; },
|
||||
[&s] { s << ", "; });
|
||||
s << "))\n";
|
||||
}
|
||||
|
||||
int IndexSubset::findNext(int startIndex) const {
|
||||
assert(startIndex < (int)capacity && "Start index cannot be past the end");
|
||||
unsigned bitWordIndex = 0, offset = 0;
|
||||
|
||||
Reference in New Issue
Block a user