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
5package crc32
6
7import "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
15func castagnoliSSE42(crc uint32, p []byte) uint32
16
17func archAvailableCastagnoli() bool {
18	return cpu.X86.HasSSE42
19}
20
21func archInitCastagnoli() {
22	if !cpu.X86.HasSSE42 {
23		panic("not available")
24	}
25	// No initialization necessary.
26}
27
28func archUpdateCastagnoli(crc uint32, p []byte) uint32 {
29	if !cpu.X86.HasSSE42 {
30		panic("not available")
31	}
32	return castagnoliSSE42(crc, p)
33}
34
35func archAvailableIEEE() bool                    { return false }
36func archInitIEEE()                              { panic("not available") }
37func archUpdateIEEE(crc uint32, p []byte) uint32 { panic("not available") }
38