Skip to content

Commit a2be7a1

Browse files
committed
readability tweaks
1 parent a696420 commit a2be7a1

File tree

1 file changed

+22
-22
lines changed
  • compiler/rustc_middle/src/mir/interpret/allocation

1 file changed

+22
-22
lines changed

Diff for: compiler/rustc_middle/src/mir/interpret/allocation/init_mask.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -254,44 +254,44 @@ impl InitMaskMaterialized {
254254
}
255255

256256
fn set_range_inbounds(&mut self, start: Size, end: Size, new_state: bool) {
257-
let (blocka, bita) = Self::bit_index(start);
258-
let (blockb, bitb) = Self::bit_index(end);
259-
if blocka == blockb {
260-
// First set all bits except the first `bita`,
261-
// then unset the last `64 - bitb` bits.
262-
let range = if bitb == 0 {
263-
u64::MAX << bita
257+
let (block_a, bit_a) = Self::bit_index(start);
258+
let (block_b, bit_b) = Self::bit_index(end);
259+
if block_a == block_b {
260+
// First set all bits except the first `bit_a`,
261+
// then unset the last `64 - bit_b` bits.
262+
let range = if bit_b == 0 {
263+
u64::MAX << bit_a
264264
} else {
265-
(u64::MAX << bita) & (u64::MAX >> (64 - bitb))
265+
(u64::MAX << bit_a) & (u64::MAX >> (64 - bit_b))
266266
};
267267
if new_state {
268-
self.blocks[blocka] |= range;
268+
self.blocks[block_a] |= range;
269269
} else {
270-
self.blocks[blocka] &= !range;
270+
self.blocks[block_a] &= !range;
271271
}
272272
return;
273273
}
274274
// across block boundaries
275275
if new_state {
276-
// Set `bita..64` to `1`.
277-
self.blocks[blocka] |= u64::MAX << bita;
278-
// Set `0..bitb` to `1`.
279-
if bitb != 0 {
280-
self.blocks[blockb] |= u64::MAX >> (64 - bitb);
276+
// Set `bit_a..64` to `1`.
277+
self.blocks[block_a] |= u64::MAX << bit_a;
278+
// Set `0..bit_b` to `1`.
279+
if bit_b != 0 {
280+
self.blocks[block_b] |= u64::MAX >> (64 - bit_b);
281281
}
282282
// Fill in all the other blocks (much faster than one bit at a time).
283-
for block in (blocka + 1)..blockb {
283+
for block in (block_a + 1)..block_b {
284284
self.blocks[block] = u64::MAX;
285285
}
286286
} else {
287-
// Set `bita..64` to `0`.
288-
self.blocks[blocka] &= !(u64::MAX << bita);
289-
// Set `0..bitb` to `0`.
290-
if bitb != 0 {
291-
self.blocks[blockb] &= !(u64::MAX >> (64 - bitb));
287+
// Set `bit_a..64` to `0`.
288+
self.blocks[block_a] &= !(u64::MAX << bit_a);
289+
// Set `0..bit_b` to `0`.
290+
if bit_b != 0 {
291+
self.blocks[block_b] &= !(u64::MAX >> (64 - bit_b));
292292
}
293293
// Fill in all the other blocks (much faster than one bit at a time).
294-
for block in (blocka + 1)..blockb {
294+
for block in (block_a + 1)..block_b {
295295
self.blocks[block] = 0;
296296
}
297297
}

0 commit comments

Comments
 (0)