Skip to content

Comment on Eliminating Go bounds checks with unsafe

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.