lunixbochs / struc

Better binary packing for Go
MIT License
564 stars 42 forks source link

default byte order? #68

Closed tmm1 closed 4 years ago

tmm1 commented 4 years ago

what is the default byte order used if none is specified in the field tag? is there a way to inherit the default byte order of the system?

tmm1 commented 4 years ago

The default is big endian:

https://github.com/lunixbochs/struc/blob/02e4c2afbb2ac4bae6876f52c8273fc4cf5a4b0a/parse.go#L25-L27

I'm using this library to marshal packed C-structs which CGO doesn't support, so I need the endianess to match the host.

tmm1 commented 4 years ago

See https://github.com/lunixbochs/struc/pull/69#issuecomment-531378138