@@ -78,7 +78,7 @@ var castagnoliTable *Table
78
78
var castagnoliTable8 * slicing8Table
79
79
var updateCastagnoli func (crc uint32 , p []byte ) uint32
80
80
var castagnoliOnce sync.Once
81
- var haveCastagnoli uint32
81
+ var haveCastagnoli atomic. Bool
82
82
83
83
func castagnoliInit () {
84
84
castagnoliTable = simpleMakeTable (Castagnoli )
@@ -94,7 +94,7 @@ func castagnoliInit() {
94
94
}
95
95
}
96
96
97
- atomic . StoreUint32 ( & haveCastagnoli , 1 )
97
+ haveCastagnoli . Store ( true )
98
98
}
99
99
100
100
// IEEETable is the table for the IEEE polynomial.
@@ -208,7 +208,7 @@ func readUint32(b []byte) uint32 {
208
208
// Update returns the result of adding the bytes in p to the crc.
209
209
func Update (crc uint32 , tab * Table , p []byte ) uint32 {
210
210
switch {
211
- case atomic . LoadUint32 ( & haveCastagnoli ) != 0 && tab == castagnoliTable :
211
+ case haveCastagnoli . Load () && tab == castagnoliTable :
212
212
return updateCastagnoli (crc , p )
213
213
case tab == IEEETable :
214
214
// Unfortunately, because IEEETable is exported, IEEE may be used without a
@@ -222,7 +222,7 @@ func Update(crc uint32, tab *Table, p []byte) uint32 {
222
222
223
223
func (d * digest ) Write (p []byte ) (n int , err error ) {
224
224
switch {
225
- case atomic . LoadUint32 ( & haveCastagnoli ) != 0 && d .tab == castagnoliTable :
225
+ case haveCastagnoli . Load () && d .tab == castagnoliTable :
226
226
d .crc = updateCastagnoli (d .crc , p )
227
227
case d .tab == IEEETable :
228
228
// We only create digest objects through New() which takes care of
0 commit comments