lunixbochs / struc

Better binary packing for Go
MIT License
576 stars 45 forks source link

default byte order? #68

Closed tmm1 closed 5 years ago

tmm1 commented 5 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 5 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 5 years ago

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