In the context of a computer game (where each player or the game board etc. holds a "state") rather than having an array of variables or storing small[ish] values (like 0 or 1 or 2 etc) in separate variables (like u32) we could treat one variable as many by turning that single variable into a multi-slot representation through the use of modulo arithmetic and exponentiation.
Hand writing memory in WebAssembly is possible. But if we are only writing in Rust and treating Wasm as a compilation target could the following idea be implemented as a design pattern for higher level programming i.e. Rust? Or, is the compiler so smart that this idea is redundant (after all of the wonderful optimisations and magic that compilers perform)?
The u32 variable in Rust can hold a value within the range of 0 to 2147483648. We essentially have access to 10 separate slots. If we initialise the variable with 1000000000
(first digit set to 1) then any of the remaining 9 slots can each hold a sepa