mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
world/section: to not use u128 type
Getting the block index for unaligned blocks can be done just fine with only u64.
This commit is contained in:
parent
3ef48783b7
commit
decb5c67a6
1 changed files with 4 additions and 6 deletions
|
@ -119,13 +119,11 @@ impl<'a> SectionV1_13<'a> {
|
|||
let bit_offset = offset * bits;
|
||||
let (word, bit_shift) = div_rem(bit_offset, 64);
|
||||
|
||||
if bit_shift + bits <= 64 {
|
||||
block_states[word] as u64 >> bit_shift
|
||||
} else {
|
||||
let tmp = (block_states[word + 1] as u64 as u128) << 64
|
||||
| block_states[word] as u64 as u128;
|
||||
(tmp >> bit_shift) as u64
|
||||
let mut tmp = (block_states[word] as u64) >> bit_shift;
|
||||
if bit_shift + bits > 64 {
|
||||
tmp |= (block_states[word + 1] as u64) << (64 - bit_shift);
|
||||
}
|
||||
tmp
|
||||
};
|
||||
|
||||
(shifted & mask) as usize
|
||||
|
|
Loading…
Add table
Reference in a new issue