From: Russ Cox Date: Wed, 2 Jan 2013 20:44:00 +0000 (-0500) Subject: sync/atomic: document that users must deal with 64-bit alignment X-Git-Tag: go1.1rc2~1500 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=64a0017d6e69f3a6ba11ad5ad35c66dc489e5cbf;p=gostls13.git sync/atomic: document that users must deal with 64-bit alignment Update #599. R=dvyukov, iant, minux.ma CC=golang-dev https://golang.org/cl/7001056 --- diff --git a/src/pkg/sync/atomic/doc.go b/src/pkg/sync/atomic/doc.go index 33e1bcf0ae..27a12c9848 100644 --- a/src/pkg/sync/atomic/doc.go +++ b/src/pkg/sync/atomic/doc.go @@ -38,9 +38,12 @@ import ( "unsafe" ) -// BUG(rsc): On ARM, the 64-bit functions use instructions unavailable before ARM 11. +// BUG(rsc): On x86-32, the 64-bit functions use instructions unavailable before the Pentium MMX. // -// On x86-32, the 64-bit functions use instructions unavailable before the Pentium MMX. +// On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit +// alignment of 64-bit words accessed atomically. The first word in a global +// variable or in an allocated struct or slice can be relied upon to be +// 64-bit aligned. // CompareAndSwapInt32 executes the compare-and-swap operation for an int32 value. func CompareAndSwapInt32(addr *int32, old, new int32) (swapped bool)