github.com/d4l3k/go@v0.0.0-20151015000803-65fc379daeda/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 386 arm arm64 ppc64 ppc64le
     6  
     7  package crc32
     8  
     9  // The file contains the generic version of updateCastagnoli which just calls
    10  // the software implementation.
    11  
    12  func updateCastagnoli(crc uint32, p []byte) uint32 {
    13  	return update(crc, castagnoliTable, p)
    14  }
    15  
    16  func updateIEEE(crc uint32, p []byte) uint32 {
    17  	// only use slicing-by-8 when input is >= 4KB
    18  	if len(p) >= 4096 {
    19  		iEEETable8Once.Do(func() {
    20  			iEEETable8 = makeTable8(IEEE)
    21  		})
    22  		return updateSlicingBy8(crc, iEEETable8, p)
    23  	}
    24  	return update(crc, IEEETable, p)
    25  }