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