]> Cypherpunks repositories - gostls13.git/commitdiff
hash/crc32: remove single-use {castagnoli,ieee}ArchImpl bools
authorTobias Klauser <tklauser@distanz.ch>
Mon, 15 Aug 2022 09:04:03 +0000 (11:04 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 18 Aug 2022 16:16:13 +0000 (16:16 +0000)
These are only used once right after being set in castagnoliInit and
ieeeInit, respectively.

Change-Id: Ifc5df1fe3040b97b1d252cc6d6d28d8fbc132fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/423854
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

src/hash/crc32/crc32.go

index f330fdb77a5272d8cd5dc77750649b79b0239977..1a24d980cc8b2830f77eef11b2183f33f05e4017 100644 (file)
@@ -76,16 +76,14 @@ type Table [256]uint32
 // using this polynomial.
 var castagnoliTable *Table
 var castagnoliTable8 *slicing8Table
-var castagnoliArchImpl bool
 var updateCastagnoli func(crc uint32, p []byte) uint32
 var castagnoliOnce sync.Once
 var haveCastagnoli uint32
 
 func castagnoliInit() {
        castagnoliTable = simpleMakeTable(Castagnoli)
-       castagnoliArchImpl = archAvailableCastagnoli()
 
-       if castagnoliArchImpl {
+       if archAvailableCastagnoli() {
                archInitCastagnoli()
                updateCastagnoli = archUpdateCastagnoli
        } else {
@@ -104,14 +102,11 @@ var IEEETable = simpleMakeTable(IEEE)
 
 // ieeeTable8 is the slicing8Table for IEEE
 var ieeeTable8 *slicing8Table
-var ieeeArchImpl bool
 var updateIEEE func(crc uint32, p []byte) uint32
 var ieeeOnce sync.Once
 
 func ieeeInit() {
-       ieeeArchImpl = archAvailableIEEE()
-
-       if ieeeArchImpl {
+       if archAvailableIEEE() {
                archInitIEEE()
                updateIEEE = archUpdateIEEE
        } else {