github.com/mh-cbon/go@v0.0.0-20160603070303-9e112a3fe4c0/src/hash/crc32/crc32_generic.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build !amd64,!amd64p32,!s390x 6 7 package crc32 8 9 // This file contains the generic version of updateCastagnoli which does 10 // slicing-by-8, or uses the fallback for very small sizes. 11 12 func updateCastagnoli(crc uint32, p []byte) uint32 { 13 // Use slicing-by-8 on larger inputs. 14 if len(p) >= sliceBy8Cutoff { 15 return updateSlicingBy8(crc, castagnoliTable8, p) 16 } 17 return update(crc, castagnoliTable, p) 18 } 19 20 func updateIEEE(crc uint32, p []byte) uint32 { 21 // Use slicing-by-8 on larger inputs. 22 if len(p) >= sliceBy8Cutoff { 23 ieeeTable8Once.Do(func() { 24 ieeeTable8 = makeTable8(IEEE) 25 }) 26 return updateSlicingBy8(crc, ieeeTable8, p) 27 } 28 return update(crc, IEEETable, p) 29 }