Commit 0c68b79e authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

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: 's avatarIan Lance Taylor <iant@golang.org>
parent bbafa21b
...@@ -52,7 +52,7 @@ func TestXadduintptr(t *testing.T) { ...@@ -52,7 +52,7 @@ func TestXadduintptr(t *testing.T) {
// Tests that xadduintptr correctly updates 64-bit values. The place where // Tests that xadduintptr correctly updates 64-bit values. The place where
// we actually do so is mstats.go, functions mSysStat{Inc,Dec}. // we actually do so is mstats.go, functions mSysStat{Inc,Dec}.
func TestXadduintptrOnUint64(t *testing.T) { func TestXadduintptrOnUint64(t *testing.T) {
if sys.BigEndian != 0 { if sys.BigEndian {
// On big endian architectures, we never use xadduintptr to update // On big endian architectures, we never use xadduintptr to update
// 64-bit values and hence we skip the test. (Note that functions // 64-bit values and hence we skip the test. (Note that functions
// mSysStat{Inc,Dec} in mstats.go have explicit checks for // mSysStat{Inc,Dec} in mstats.go have explicit checks for
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = I386 ArchFamily = I386
BigEndian = 0 BigEndian = false
CacheLineSize = 64 CacheLineSize = 64
DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl
PCQuantum = 1 PCQuantum = 1
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = AMD64 ArchFamily = AMD64
BigEndian = 0 BigEndian = false
CacheLineSize = 64 CacheLineSize = 64
DefaultPhysPageSize = 4096 DefaultPhysPageSize = 4096
PCQuantum = 1 PCQuantum = 1
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = AMD64 ArchFamily = AMD64
BigEndian = 0 BigEndian = false
CacheLineSize = 64 CacheLineSize = 64
DefaultPhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) DefaultPhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
PCQuantum = 1 PCQuantum = 1
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = ARM ArchFamily = ARM
BigEndian = 0 BigEndian = false
CacheLineSize = 32 CacheLineSize = 32
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = ARM64 ArchFamily = ARM64
BigEndian = 0 BigEndian = false
CacheLineSize = 64 CacheLineSize = 64
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = MIPS ArchFamily = MIPS
BigEndian = 1 BigEndian = true
CacheLineSize = 32 CacheLineSize = 32
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = MIPS64 ArchFamily = MIPS64
BigEndian = 1 BigEndian = true
CacheLineSize = 32 CacheLineSize = 32
DefaultPhysPageSize = 16384 DefaultPhysPageSize = 16384
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = MIPS64 ArchFamily = MIPS64
BigEndian = 0 BigEndian = false
CacheLineSize = 32 CacheLineSize = 32
DefaultPhysPageSize = 16384 DefaultPhysPageSize = 16384
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = MIPS ArchFamily = MIPS
BigEndian = 0 BigEndian = false
CacheLineSize = 32 CacheLineSize = 32
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = PPC64 ArchFamily = PPC64
BigEndian = 1 BigEndian = true
CacheLineSize = 128 CacheLineSize = 128
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = PPC64 ArchFamily = PPC64
BigEndian = 0 BigEndian = false
CacheLineSize = 128 CacheLineSize = 128
DefaultPhysPageSize = 65536 DefaultPhysPageSize = 65536
PCQuantum = 4 PCQuantum = 4
......
...@@ -6,7 +6,7 @@ package sys ...@@ -6,7 +6,7 @@ package sys
const ( const (
ArchFamily = S390X ArchFamily = S390X
BigEndian = 1 BigEndian = true
CacheLineSize = 256 CacheLineSize = 256
DefaultPhysPageSize = 4096 DefaultPhysPageSize = 4096
PCQuantum = 2 PCQuantum = 2
......
...@@ -664,7 +664,7 @@ func purgecachedstats(c *mcache) { ...@@ -664,7 +664,7 @@ func purgecachedstats(c *mcache) {
// overflow errors. // overflow errors.
//go:nosplit //go:nosplit
func mSysStatInc(sysStat *uint64, n uintptr) { func mSysStatInc(sysStat *uint64, n uintptr) {
if sys.BigEndian != 0 { if sys.BigEndian {
atomic.Xadd64(sysStat, int64(n)) atomic.Xadd64(sysStat, int64(n))
return return
} }
...@@ -678,7 +678,7 @@ func mSysStatInc(sysStat *uint64, n uintptr) { ...@@ -678,7 +678,7 @@ func mSysStatInc(sysStat *uint64, n uintptr) {
// mSysStatInc apply. // mSysStatInc apply.
//go:nosplit //go:nosplit
func mSysStatDec(sysStat *uint64, n uintptr) { func mSysStatDec(sysStat *uint64, n uintptr) {
if sys.BigEndian != 0 { if sys.BigEndian {
atomic.Xadd64(sysStat, -int64(n)) atomic.Xadd64(sysStat, -int64(n))
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment