← Back to context

Comment by whytevuhuni

25 days ago

Will it be okay though? i32 to u64 has two ways to convert it:

    i32 -> u32 -> u64
    i32 -> i64 -> u64

This matters with negative numbers, where the first one pads with 32 bits of 0, the second one pads it with 32 bits of 1. Sometimes (as it once happened to me), you wanted the wrong one.

Yes, it will be okay because I'm making a pretty picture :) If the default behavior of a conversion surprises me, I'd be able to sus it out and replace it with explicit behavior.

I'm not saying this is worth adding such a thing to Rust just for this use case, but it would be very nice not to write intos for every number