Closed Jedsek closed 2 years ago
pub fn transform(&self, direction: Direction, times: u16) -> Self { let times = times as i16; /*....omitted....*/ }
u16 -> [0, 65535] i16 -> [-32768, 32767]
For example: If times is 60000_u16, times = times as i16 will get -5536_i16 u16 can be rewritten to i32 (And in another fn: transform_value)
times
60000_u16
times = times as i16
-5536_i16
u16
i32
transform_value
u16 -> [0, 65535] i16 -> [-32768, 32767]
For example: If
times
is60000_u16
,times = times as i16
will get-5536_i16
u16
can be rewritten toi32
(And in another fn:transform_value
)