You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let i = -1000i32;
let ii = i32x2::new(i,i);
let uu = u32x2::from(ii);
57 | let uu = u32x2::from(ii);
| ^^^^^^^^^^^ the trait `std::convert::From<packed_simd::Simd<[i32; 2]>>` is not implemented for `packed_simd::Simd<[u32; 2]>`
The text was updated successfully, but these errors were encountered:
This is intended behavior, you want let uu: u32x2 = ii.cast(); which is pretty much like as. Note that:
fnmain(){let i = -1000i32;let u = u32::from(i);}
also produces the same error. From/Into perform lossless value preserving conversions, but the conversion you want to perform is not value preserving for all values. For primitive types, you could use TryFrom/TryInto which return an Option<u32> with Some or None depending of for the particular value provided the conversion was value-preserving, but for a negative integer conversion into an unsigned integer it will always return None since that is never value preserving. There is a section in the main documentation explaining this, but it basically means that the same rules apply for the vector types and for the primitive types: https://rust-lang-nursery.github.io/packed_simd/packed_simd/#conversions
The docs.rs builds are sadly broken (see #110), I'll do a release once that is fixed so that these become more easily discoverable. Right now they are linked in the readme if you need to find these again.
Bug?
The text was updated successfully, but these errors were encountered: