I am a beginner in Rust and currently implement my own fixed-point arithemtic.
While implementing bitshift operations I noticed something that bugs me.
let a:i32 = 100; let b = 3; let c:i32 = a << b;
b have to be
i32 as well?
It makes no sense in my head that you can bitshift with a potentially negative value (I come form a C-like language). I would have thought that Rust tries to force me to use an unsigned type here to enforce more code safety. Maybe even just
u8 as there is no primitive type that makes sense to apply bitshifts of more than 63.
Thanks for the upcoming replies.