ab: u32
let mask = ((1 << 16 ) - 1) as u32;
let a = ((ab >> 16) & mask) as u16;
let b = ((ab >> 0) & mask) as u16;
Is there a cleaner way to split a u32 into two u16's? (I know that the &mask is redundant in the 'a' case, and the ">>0" is redundant in the b case, this is just to make it look a bit more symmetrical).