...
Run Format

Source file src/hash/crc32/crc32_amd64p32.go

Documentation: hash/crc32

     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  package crc32
     6  
     7  import "internal/cpu"
     8  
     9  // This file contains the code to call the SSE 4.2 version of the Castagnoli
    10  // CRC.
    11  
    12  // castagnoliSSE42 is defined in crc32_amd64p32.s and uses the SSE4.2 CRC32
    13  // instruction.
    14  //go:noescape
    15  func castagnoliSSE42(crc uint32, p []byte) uint32
    16  
    17  func archAvailableCastagnoli() bool {
    18  	return cpu.X86.HasSSE42
    19  }
    20  
    21  func archInitCastagnoli() {
    22  	if !cpu.X86.HasSSE42 {
    23  		panic("not available")
    24  	}
    25  	// No initialization necessary.
    26  }
    27  
    28  func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
    29  	if !cpu.X86.HasSSE42 {
    30  		panic("not available")
    31  	}
    32  	return castagnoliSSE42(crc, p)
    33  }
    34  
    35  func archAvailableIEEE() bool                    { return false }
    36  func archInitIEEE()                              { panic("not available") }
    37  func archUpdateIEEE(crc uint32, p []byte) uint32 { panic("not available") }
    38  

View as plain text