lukechampine / blake3

An AVX-512 accelerated implementation of the BLAKE3 cryptographic hash function
MIT License
352 stars 25 forks source link

Support newer cpuid #12

Closed jgoerzen closed 3 years ago

jgoerzen commented 3 years ago

Hi,

While packaging this for Debian, we have cpuid v2 in the repository and I needed to get it to compile with that version.

The patch for compatibility with cpuid v2 is simple:

--- a/cpu.go
+++ b/cpu.go
@@ -5,6 +5,6 @@
 import "github.com/klauspost/cpuid"

 var (
-   haveAVX2   = cpuid.CPU.AVX2()
-   haveAVX512 = cpuid.CPU.AVX512F()
+   haveAVX2   = cpuid.CPU.Supports(cpuid.AVX2)
+   haveAVX512 = cpuid.CPU.Supports(cpuid.AVX512F)
 )

Thanks!

lukechampine commented 3 years ago

fixed in https://github.com/lukechampine/blake3/commit/09d3897aaa0fdbc603afcf54cfe25bf5d677a6b4