The byte order fallacy
https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html
On Friday, October 3, 2025 at 11:01:30 AM UTC-4 R. Men wrote:
> Hello, I'm new to the language and I have a question about uvarint
> decoding, hoping someone can clarify. Looking at the the source code, it
> seems to assume that data is littleEndian and converts to bigEndian. What
> if my data is already bigEndian?
>
> Here's the current problem I'm trying to resolve
> buf{0x81, 0x47} ----> 1000 0001 , 0100 0111
>
> I'm expecting ----> x000 0001 , x100 0111
> ----> 0000 0000 , 1100 0111
> ----> 0xC7
> but instead I'm getting
> -----> x100 0111 , x000 0001
> -----> 0010 0011 , 1000 0001
> -----> 0x2381
> Is there a variant of uvarint that preserves the order or some solution to
> this?
> Thank you for the help!
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/golang-nuts/2350cf1c-5ef7-45ce-9765-eda48d59ecf5n%40googlegroups.com.