[go-nuts] Re: How do I convert a byte into BigEndian or LittleEndian?
Thanks! :-) On Monday, February 27, 2017 at 4:45:19 PM UTC-5, Glen Newton wrote: > > > > Given a byte b, how do I convert it to a byte of particular endianness? > It is not clear to me looking at "encoding/binary" > > (I am assuming that golang byte endianness varies across architectures. > If this is wrong please educate me). :-) > > Thanks, > Glen > -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] Re: How do I convert a byte into BigEndian or LittleEndian?
On Feb 27, 2017, at 1:54 PM, Glen Newtonwrote: > Ack! Sorry. > > I was referring to bit endianness https://en.wikipedia.org/wiki/Bit_numbering I think the golang package only deals with byte-oriented interfaces. Most CPUs can't address units smaller than a byte anyway, so endianness isn't really observable from software. So the bit-endianness of individual bytes is determined by whatever you are passing those bytes to (presumably some hardware port?). -- 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. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: How do I convert a byte into BigEndian or LittleEndian?
Ah, I've been thinking about this issue too much and have confused myself. And, I have expressed it as an XY Problem! :-( My real question should have been: if I write a byte to a file on one architecture, will the byte be the same on all other architectures (i.e. 386, amd64, arm, s390x, ppc64le) if read by a Go program on them? Sorry for my confusion. :-) Thanks, Glen On Monday, February 27, 2017 at 4:45:19 PM UTC-5, Glen Newton wrote: > > > > Given a byte b, how do I convert it to a byte of particular endianness? > It is not clear to me looking at "encoding/binary" > > (I am assuming that golang byte endianness varies across architectures. > If this is wrong please educate me). :-) > > Thanks, > Glen > -- 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. For more options, visit https://groups.google.com/d/optout.
[go-nuts] Re: How do I convert a byte into BigEndian or LittleEndian?
Ack! Sorry. I was referring to *bit endianness* https://en.wikipedia.org/wiki/Bit_numbering On Monday, February 27, 2017 at 4:45:19 PM UTC-5, Glen Newton wrote: > > > > Given a byte b, how do I convert it to a byte of particular endianness? > It is not clear to me looking at "encoding/binary" > > (I am assuming that golang byte endianness varies across architectures. > If this is wrong please educate me). :-) > > Thanks, > Glen > -- 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. For more options, visit https://groups.google.com/d/optout.