aboutsummaryrefslogtreecommitdiff
path: root/src/hash
diff options
context:
space:
mode:
authorMartin Möhrmann <moehrmann@google.com>2018-07-28 09:08:09 +0200
committerMartin Möhrmann <moehrmann@google.com>2018-08-20 14:47:07 +0000
commitcd0e79d9f136088929f3c7aab53998793bf273ba (patch)
tree5944c856a238e3066dc4073f86a29338187ff445 /src/hash
parent099498db0e47ba01ec405ca27662d9a87ef921e2 (diff)
downloadgo-cd0e79d9f136088929f3c7aab53998793bf273ba.tar.gz
go-cd0e79d9f136088929f3c7aab53998793bf273ba.zip
all: use internal/cpu feature variables directly
Avoid using package specific variables when there is a one to one correspondance to cpu feature support exported by internal/cpu. This makes it clearer which cpu feature is referenced. Another advantage is that internal/cpu variables are padded to avoid false sharing and memory and cache usage is shared by multiple packages. Change-Id: If18fb448a95207cfa6a3376f3b2ddc4b230dd138 Reviewed-on: https://go-review.googlesource.com/126596 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/hash')
-rw-r--r--src/hash/crc32/crc32_arm64.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/hash/crc32/crc32_arm64.go b/src/hash/crc32/crc32_arm64.go
index 1f8779d506..0242d1d8a7 100644
--- a/src/hash/crc32/crc32_arm64.go
+++ b/src/hash/crc32/crc32_arm64.go
@@ -13,20 +13,18 @@ import "internal/cpu"
func castagnoliUpdate(crc uint32, p []byte) uint32
func ieeeUpdate(crc uint32, p []byte) uint32
-var hasCRC32 = cpu.ARM64.HasCRC32
-
func archAvailableCastagnoli() bool {
- return hasCRC32
+ return cpu.ARM64.HasCRC32
}
func archInitCastagnoli() {
- if !hasCRC32 {
+ if !cpu.ARM64.HasCRC32 {
panic("arch-specific crc32 instruction for Catagnoli not available")
}
}
func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
- if !hasCRC32 {
+ if !cpu.ARM64.HasCRC32 {
panic("arch-specific crc32 instruction for Castagnoli not available")
}
@@ -34,17 +32,17 @@ func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
}
func archAvailableIEEE() bool {
- return hasCRC32
+ return cpu.ARM64.HasCRC32
}
func archInitIEEE() {
- if !hasCRC32 {
+ if !cpu.ARM64.HasCRC32 {
panic("arch-specific crc32 instruction for IEEE not available")
}
}
func archUpdateIEEE(crc uint32, p []byte) uint32 {
- if !hasCRC32 {
+ if !cpu.ARM64.HasCRC32 {
panic("arch-specific crc32 instruction for IEEE not available")
}