[−][src]Function morton_encoding::bloat
pub fn bloat<Coor, Key>(x: Coor) -> Key where
Coor: ToPrimitive,
Key: ValidKey<Coor>,
"Bloats" a given number, interleaving its bits with an automatically-computed number of zeroes.
The size ratio for the "bloating" is computed as the ratio of the sizes of the provided types.
Never panics.
Examples
assert_eq!(bloat::<u8, u32>(0xFF), 0x1111_1111); assert_eq!(bloat::<_, u64>(0x1111_1111u32), 0x0101_0101_0101_0101);
Will fail to compile if the Key
type is smaller than the Coor
type:
ⓘThis example deliberately fails to compile
let bad_fn = bloat::<u16, u8>; // Does not compile!