Thanks. Although I'm not worried about the native byte order of my machine I'm writing an ARM emulator. The endianness of the ARM I'm taking to be whatever the endianess is in the ELF file from which I'm loading the program. I'm using the debug/elf package in the standard library which in turn uses the binary package
Generally, the specifics of the byte order is irrelevant - I can just use Uint32(), PutUint32() etc. but in some specific instructions it's easier to handle the byte order manually and for that I need to know what the endianness is. I can work around it but I just thought I might be missing something. Regards Stephen On Thursday, 10 August 2023 at 14:16:53 UTC+1 Rob Pike wrote: > First read > https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html > > then see > > https://go.dev/play/p/4ESm6nOwgtY > > -rob > > > > > > > On Thu, Aug 10, 2023 at 8:46 PM Stephen Illingworth < > stephen.i...@gmail.com> wrote: > >> Hello, >> >> I want to detect the implementation of binary.ByteOrder. ie. whether it >> is Little Endian or Big Endian. >> >> Normally, you would do this with a type assertion or a type switch but in >> the case of the binary package the little/big endian implementations are >> not exported. >> >> The only way that I can see to distinguish between the implementations is >> to test the value returned by String(). Am I missing something here or >> should I continue to use String()? >> >> Regards >> Stephen >> >> -- >> 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 golang-nuts...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/67469c8a-b1aa-4976-8f4a-2b4458d28214n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/67469c8a-b1aa-4976-8f4a-2b4458d28214n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/618e2a97-670f-4df7-98f3-a9b576ad8971n%40googlegroups.com.