mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
util: turn range check into debug_assert!()
More performance optimization.
This commit is contained in:
parent
21035a1f7f
commit
9c4161f688
1 changed files with 2 additions and 7 deletions
|
@ -40,13 +40,8 @@ pub fn coord_offset<const AXIS: u8>(
|
|||
let coord = ((chunk.0 as i32) << BLOCK_BITS | block.0 as i32) + offset;
|
||||
let (region_chunk, block) = coord.shift_mask(BLOCK_BITS);
|
||||
let (region, chunk) = region_chunk.shift_mask(CHUNK_BITS);
|
||||
(
|
||||
region
|
||||
.try_into()
|
||||
.expect("the region coordinate should be in the valid range"),
|
||||
ChunkCoord::new(chunk),
|
||||
BlockCoord::new(block),
|
||||
)
|
||||
debug_assert!(i8::try_from(region).is_ok());
|
||||
(region as i8, ChunkCoord::new(chunk), BlockCoord::new(block))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Reference in a new issue