mirror of
https://github.com/golang/go
synced 2024-11-23 05:40:04 -07:00
[dev.typeparams] runtime/internal/sys: replace BigEndian with goarch.BigEndian [generated]
[git-generate] cd src/runtime/internal/atomic gofmt -w -r "sys.BigEndian -> goarch.BigEndian" . goimports -w *.go cd ../.. gofmt -w -r "sys.BigEndian -> goarch.BigEndian" . goimports -w *.go Change-Id: Iad35d2b367d8defb081a77ca837e7a7c805c2b7b Reviewed-on: https://go-review.googlesource.com/c/go/+/329190 Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
9c58e399a4
commit
9a93072a07
@ -7,7 +7,6 @@ package runtime
|
||||
import (
|
||||
"internal/cpu"
|
||||
"internal/goarch"
|
||||
"runtime/internal/sys"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -338,7 +337,7 @@ func initAlgAES() {
|
||||
// Note: These routines perform the read with a native endianness.
|
||||
func readUnaligned32(p unsafe.Pointer) uint32 {
|
||||
q := (*[4]byte)(p)
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
return uint32(q[3]) | uint32(q[2])<<8 | uint32(q[1])<<16 | uint32(q[0])<<24
|
||||
}
|
||||
return uint32(q[0]) | uint32(q[1])<<8 | uint32(q[2])<<16 | uint32(q[3])<<24
|
||||
@ -346,7 +345,7 @@ func readUnaligned32(p unsafe.Pointer) uint32 {
|
||||
|
||||
func readUnaligned64(p unsafe.Pointer) uint64 {
|
||||
q := (*[8]byte)(p)
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
return uint64(q[7]) | uint64(q[6])<<8 | uint64(q[5])<<16 | uint64(q[4])<<24 |
|
||||
uint64(q[3])<<32 | uint64(q[2])<<40 | uint64(q[1])<<48 | uint64(q[0])<<56
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ var Write = write
|
||||
func Envs() []string { return envs }
|
||||
func SetEnvs(e []string) { envs = e }
|
||||
|
||||
var BigEndian = sys.BigEndian
|
||||
var BigEndian = goarch.BigEndian
|
||||
|
||||
// For benchmarking.
|
||||
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"internal/abi"
|
||||
"internal/goarch"
|
||||
"runtime/internal/atomic"
|
||||
"runtime/internal/sys"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -336,7 +335,7 @@ func convT2E(t *_type, elem unsafe.Pointer) (e eface) {
|
||||
func convT16(val uint16) (x unsafe.Pointer) {
|
||||
if val < uint16(len(staticuint64s)) {
|
||||
x = unsafe.Pointer(&staticuint64s[val])
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
x = add(x, 6)
|
||||
}
|
||||
} else {
|
||||
@ -349,7 +348,7 @@ func convT16(val uint16) (x unsafe.Pointer) {
|
||||
func convT32(val uint32) (x unsafe.Pointer) {
|
||||
if val < uint32(len(staticuint64s)) {
|
||||
x = unsafe.Pointer(&staticuint64s[val])
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
x = add(x, 4)
|
||||
}
|
||||
} else {
|
||||
|
@ -5,9 +5,9 @@
|
||||
package atomic_test
|
||||
|
||||
import (
|
||||
"internal/goarch"
|
||||
"runtime"
|
||||
"runtime/internal/atomic"
|
||||
"runtime/internal/sys"
|
||||
"testing"
|
||||
"unsafe"
|
||||
)
|
||||
@ -56,7 +56,7 @@ func TestXadduintptr(t *testing.T) {
|
||||
// Tests that xadduintptr correctly updates 64-bit values. The place where
|
||||
// we actually do so is mstats.go, functions mSysStat{Inc,Dec}.
|
||||
func TestXadduintptrOnUint64(t *testing.T) {
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
// On big endian architectures, we never use xadduintptr to update
|
||||
// 64-bit values and hence we skip the test. (Note that functions
|
||||
// mSysStat{Inc,Dec} in mstats.go have explicit checks for
|
||||
|
@ -7,7 +7,7 @@ package runtime
|
||||
import (
|
||||
"internal/abi"
|
||||
"internal/bytealg"
|
||||
"runtime/internal/sys"
|
||||
"internal/goarch"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -96,7 +96,7 @@ func slicebytetostring(buf *tmpBuf, ptr *byte, n int) (str string) {
|
||||
}
|
||||
if n == 1 {
|
||||
p := unsafe.Pointer(&staticuint64s[*ptr])
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
p = add(p, 7)
|
||||
}
|
||||
stringStructOf(&str).str = p
|
||||
|
@ -569,7 +569,7 @@ func printArgs(f funcInfo, argp unsafe.Pointer) {
|
||||
// mask out irrelavant bits
|
||||
if sz < 8 {
|
||||
shift := 64 - sz*8
|
||||
if sys.BigEndian {
|
||||
if goarch.BigEndian {
|
||||
x = x >> shift
|
||||
} else {
|
||||
x = x << shift >> shift
|
||||
|
Loading…
Reference in New Issue
Block a user