Comment on Eliminating Go bounds checks with unsafeComments−ncruces1moThe article should note this: it's important that you don't go adding other/all little endian platforms to that go:build line.The article is correct, but this code is only valid for platforms that allow unaligned access.You can get the full list of platforms that Go considers safe for this from unalignedOK here: https://go.dev/src/cmd/compile/internal/ssa/config.goYou want the intersection of unalignedOK with little endian.−molecularman1moThank you. I've added your comment to the essay.
Comments
The article should note this: it's important that you don't go adding other/all little endian platforms to that go:build line.
The article is correct, but this code is only valid for platforms that allow unaligned access.
You can get the full list of platforms that Go considers safe for this from unalignedOK here: https://go.dev/src/cmd/compile/internal/ssa/config.go
You want the intersection of unalignedOK with little endian.
Thank you. I've added your comment to the essay.