Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse u32 to represent variant tags. #10
Conversation
This makes it possible to exchange binary serialized structures between different architectures, and reduces bandwidth. I doubt it's even possible to have more than 4 billions variants anyway :).
|
Right now my code works between architectures because self.read_uint() and self.emit_uint() are producing u64 on both x86 and x86-64. However, I do buy your argument that 32-bits are more than enough. I'll merge this when I figure out what is happening with the Travis-CI build. |
|
Actually, what about forcing emit_uint() to fit in a u32 instead of a u64? I'll need to bump the version number because it is a breaking change, but it will make it so that once a message is encoded somewhere, it can be decoded anywhere. |
|
I hadn't noticed that you use On the other hand, I think that forcing The build might be failing because you're depending on an outdated |
|
The thing is that uint shows up a lot in rust data structures like Vec and HashMap, so it's not really their fault. I could do the checking on the deserialization side as an alternative. If it tries to deserialize a value that is to big to fit in a 32-bit uint, it could fail. |
|
Also, yeah, the build was failing because I was using an old version of |
|
Mhm, right, I guess serializing What's certain is that encoding variant tags to |
Use u32 to represent variant tags.
|
Thanks for the pull request, I've thought about it for a bit and decided to merge! |
bitonic commentedJan 3, 2015
This makes it possible to exchange binary serialized structures between
different architectures, and reduces bandwidth. I doubt it's even
possible to have more than 4 billions variants anyway :).