On Thu, Nov 28, 2019 at 3:16 AM Michael Jones <michael.jo...@gmail.com> wrote: > > The general rule -- if there can be a general rule for risk behavior -- is > that CPUs like having addresses aligned on an integer multiple of the data > element size. So: > > access-as-byte data may be on any address (address&(1-1)==0), > access as 2-byte data on a multiple of two address (address&(2-1)==0), > access as 4-byte data on a multiple of four address (address&(4-1)==0), > access as 8-byte data on a multiple of eight address (address&(8-1)==0), > access as 16-byte data on a multiple of sixteen address (address&(16-1)==0),
It's a bit more complicated for struct fields on 386, some 8 byte data are 4 byte aligned. -- 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/CAA40n-U7tcWxq65pOGZhk2oLfgR2z3fMpK1Z2un65tmjv9%3DQaw%40mail.gmail.com.