ensnare-org / ensnare-v1

A library for generating digital audio.
https://ensnare.me
Other
2 stars 1 forks source link

usize/isize vs u32/u64/u128 etc. in serialized formats #22

Open sowbug opened 5 months ago

sowbug commented 5 months ago

Almost certainly an academic issue.

If a project is serialized on a 64-bit machine, then deserialized on a 32-bit machine, then any usize that's larger than a u32 will (?) cause an overflow. If we want project files to be portable, then this is a problem.

Counterargument: we're not checking for overflow on anything that's a usize/isize, so if it's possible to get a number larger than 2^32 on a 64-bit machine, then the same operation would have failed on a 32-bit machine long before we got around to saving the project.