1
Fork 0

Rollup merge of #110451 - WaffleLapkin:ensure_return_elem, r=scottmcm

Minor changes to `IndexVec::ensure_contains_elem` & related methods

r? `@scottmcm`
This commit is contained in:
Matthias Krüger 2023-04-19 06:35:34 +02:00 committed by GitHub
commit a184557d1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 26 deletions

View file

@ -413,8 +413,8 @@ impl<I: Idx, const N: usize, T: FixedSizeEncoding<ByteArray = [u8; N]>> TableBui
// > Space requirements could perhaps be optimized by using the HAMT `popcnt`
// > trick (i.e. divide things into buckets of 32 or 64 items and then
// > store bit-masks of which item in each bucket is actually serialized).
self.blocks.ensure_contains_elem(i, || [0; N]);
value.write_to_bytes(&mut self.blocks[i]);
let block = self.blocks.ensure_contains_elem(i, || [0; N]);
value.write_to_bytes(block);
}
}