|
|
|
|
|
by aninhumer
3676 days ago
|
|
My feeling is that the clearest way to do this would be: self.0.stack_index = stack_index;
using an appropriate packed struct/union type such that this makes sense.This best represents what you're actually doing, instead of faffing around with bit twiddling to achieve the same result. Does Rust not allow something like this? |
|
There should be. Obviously, unions with pointers are special. Some code might need to be marked unsafe. I suspect there is a subset of pointer-in-union operations that could be made safe, possibly either changing or using the pointer but not both.
Another thing missing is bifields. I'd love to see this done right, with adjustable packing so that one can use them to write an emulator or file parser.