github.com/guyezi/gofrontend@v0.0.0-20200228202240-7a62a49e62c0/libgo/go/hash/crc32/crc32_arm64.go (about) 1 // Copyright 2017 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 ignore 6 7 // ARM64-specific hardware-assisted CRC32 algorithms. See crc32.go for a 8 // description of the interface that each architecture-specific file 9 // implements. 10 11 package crc32 12 13 import "internal/cpu" 14 15 func castagnoliUpdate(crc uint32, p []byte) uint32 16 func ieeeUpdate(crc uint32, p []byte) uint32 17 18 func archAvailableCastagnoli() bool { 19 return cpu.ARM64.HasCRC32 20 } 21 22 func archInitCastagnoli() { 23 if !cpu.ARM64.HasCRC32 { 24 panic("arch-specific crc32 instruction for Catagnoli not available") 25 } 26 } 27 28 func archUpdateCastagnoli(crc uint32, p []byte) uint32 { 29 if !cpu.ARM64.HasCRC32 { 30 panic("arch-specific crc32 instruction for Castagnoli not available") 31 } 32 33 return ^castagnoliUpdate(^crc, p) 34 } 35 36 func archAvailableIEEE() bool { 37 return cpu.ARM64.HasCRC32 38 } 39 40 func archInitIEEE() { 41 if !cpu.ARM64.HasCRC32 { 42 panic("arch-specific crc32 instruction for IEEE not available") 43 } 44 } 45 46 func archUpdateIEEE(crc uint32, p []byte) uint32 { 47 if !cpu.ARM64.HasCRC32 { 48 panic("arch-specific crc32 instruction for IEEE not available") 49 } 50 51 return ^ieeeUpdate(^crc, p) 52 }