Open moonheart08 opened 5 years ago
There's a similar discussion here: https://internals.rust-lang.org/t/pre-rfc-generic-integers-uint-n-and-int-n/7641
There is a postponed RFC: https://github.com/rust-lang/rfcs/pull/2581
C is getting generic integers: https://github.com/rust-lang/rfcs/pull/2581#issuecomment-887036118
Does it make sense to make a full featured PoC crate for integers of any size (<=128) and eventually merge into the compiler? Or something like that should be built directly inside of rustc from the ground up?
LLVM itself supports arbitrary bitlength integers, however Rust does not. This would be useful for some less common, but still fairly normal cases, like 24-bit integers for emulating CPUs like the MC68000 (Some models use 24-bit address busses instead of 32-bit), or for memory constrained systems where you need all the space you can get, and as such packed bitfields are the best for storing data.