1
0
mirror of https://github.com/golang/go synced 2024-11-12 01:10:21 -07:00

runtime/internal/sys: use boolean constants for sys.BigEndian

The BigEndian constant is only used in boolean context so assign it
boolean constants.

Change-Id: If19d61dd71cdfbffede1d98b401f11e6535fba59
Reviewed-on: https://go-review.googlesource.com/73270
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser 2017-10-25 11:28:56 +02:00 committed by Tobias Klauser
parent bbafa21b37
commit 0c68b79e9c
14 changed files with 15 additions and 15 deletions

View File

@ -52,7 +52,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 != 0 {
if sys.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

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = I386
BigEndian = 0
BigEndian = false
CacheLineSize = 64
DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl
PCQuantum = 1

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = AMD64
BigEndian = 0
BigEndian = false
CacheLineSize = 64
DefaultPhysPageSize = 4096
PCQuantum = 1

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = AMD64
BigEndian = 0
BigEndian = false
CacheLineSize = 64
DefaultPhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
PCQuantum = 1

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = ARM
BigEndian = 0
BigEndian = false
CacheLineSize = 32
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = ARM64
BigEndian = 0
BigEndian = false
CacheLineSize = 64
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = MIPS
BigEndian = 1
BigEndian = true
CacheLineSize = 32
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = MIPS64
BigEndian = 1
BigEndian = true
CacheLineSize = 32
DefaultPhysPageSize = 16384
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = MIPS64
BigEndian = 0
BigEndian = false
CacheLineSize = 32
DefaultPhysPageSize = 16384
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = MIPS
BigEndian = 0
BigEndian = false
CacheLineSize = 32
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = PPC64
BigEndian = 1
BigEndian = true
CacheLineSize = 128
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = PPC64
BigEndian = 0
BigEndian = false
CacheLineSize = 128
DefaultPhysPageSize = 65536
PCQuantum = 4

View File

@ -6,7 +6,7 @@ package sys
const (
ArchFamily = S390X
BigEndian = 1
BigEndian = true
CacheLineSize = 256
DefaultPhysPageSize = 4096
PCQuantum = 2

View File

@ -664,7 +664,7 @@ func purgecachedstats(c *mcache) {
// overflow errors.
//go:nosplit
func mSysStatInc(sysStat *uint64, n uintptr) {
if sys.BigEndian != 0 {
if sys.BigEndian {
atomic.Xadd64(sysStat, int64(n))
return
}
@ -678,7 +678,7 @@ func mSysStatInc(sysStat *uint64, n uintptr) {
// mSysStatInc apply.
//go:nosplit
func mSysStatDec(sysStat *uint64, n uintptr) {
if sys.BigEndian != 0 {
if sys.BigEndian {
atomic.Xadd64(sysStat, -int64(n))
return
}