wwylele / save3ds

Extract/Import/FUSE for 3DS save/extdata/database.
Apache License 2.0
54 stars 6 forks source link

Build failure for 32-bit Windows targets #3

Closed ihaveamac closed 4 years ago

ihaveamac commented 4 years ago

Some overflow issues have appeared when trying to build for i686-pc-windows-msvc (and i686-pc-windows-gnu).

E:\save3ds>cargo build --release --target=i686-pc-windows-msvc
...
   Compiling libsave3ds v0.1.0 (E:\save3ds\libsave3ds)
error: attempt to shift left with overflow
  --> libsave3ds\src\fs_meta.rs:26:37
   |
26 |         self.block_index as usize | ((self.block_count as usize) << 32)
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[deny(exceeding_bitshifts)]` on by default

error: attempt to shift right with overflow
  --> libsave3ds\src\fs_meta.rs:21:26
   |
21 |             block_count: (offset >> 32) as u32,
   |                          ^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

error: could not compile `libsave3ds`.
wwylele commented 4 years ago

Will fix soon. This particular one should be easy to get compiled without error, but in general the entire project has assumption of usize=u64 (some of them boils down to some array needs to be able to hold >4 giga element in some extreme edge cases). I guess this is generally a bad idea but don't have much idea how to fix it.

wwylele commented 4 years ago

Should be mitigated by https://github.com/wwylele/save3ds/commit/1bef18a07a2a784af496baaa8f093af1a4399efd

ihaveamac commented 4 years ago

Looks like it builds and runs fine now, thanks.