Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Vendor a minimal internal/cpu for AMD64 only

Runxi Yu a75e1674 4a796e64

+92 -5
-2
go.mod
··· 1 1 module codeberg.org/lindenii/furgit 2 2 3 3 go 1.26.0 4 - 5 - require golang.org/x/sys v0.41.0
-2
go.sum
··· 1 - golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= 2 - golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+1 -1
internal/adler32/adler32_amd64.go
··· 8 8 "hash" 9 9 "hash/adler32" 10 10 11 - "golang.org/x/sys/cpu" 11 + "codeberg.org/lindenii/furgit/internal/cpu" 12 12 ) 13 13 14 14 // Size of an Adler-32 checksum in bytes.
+27
internal/cpu/LICENSE
··· 1 + Copyright 2009 The Go Authors. 2 + 3 + Redistribution and use in source and binary forms, with or without 4 + modification, are permitted provided that the following conditions are 5 + met: 6 + 7 + * Redistributions of source code must retain the above copyright 8 + notice, this list of conditions and the following disclaimer. 9 + * Redistributions in binary form must reproduce the above 10 + copyright notice, this list of conditions and the following disclaimer 11 + in the documentation and/or other materials provided with the 12 + distribution. 13 + * Neither the name of Google LLC nor the names of its 14 + contributors may be used to endorse or promote products derived from 15 + this software without specific prior written permission. 16 + 17 + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+6
internal/cpu/cpu.go
··· 1 + package cpu 2 + 3 + // X86 contains x86 CPU feature flags detected at runtime. 4 + var X86 struct { 5 + HasAVX2 bool 6 + }
+33
internal/cpu/cpu_amd64.go
··· 1 + //go:build amd64 && !purego 2 + 3 + package cpu 4 + 5 + const ( 6 + cpuidOSXSAVE = 1 << 27 7 + cpuidAVX = 1 << 28 8 + cpuidAVX2 = 1 << 5 9 + ) 10 + 11 + // cpuid is implemented in cpu_amd64.s. 12 + func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 13 + 14 + // xgetbv with ecx = 0 is implemented in cpu_amd64.s. 15 + func xgetbv() (eax, edx uint32) 16 + 17 + func init() { 18 + maxID, _, _, _ := cpuid(0, 0) 19 + if maxID < 7 { 20 + return 21 + } 22 + 23 + _, _, ecx1, _ := cpuid(1, 0) 24 + 25 + osSupportsAVX := false 26 + if ecx1&cpuidOSXSAVE != 0 { 27 + eax, _ := xgetbv() 28 + osSupportsAVX = eax&(1<<1) != 0 && eax&(1<<2) != 0 29 + } 30 + 31 + _, ebx7, _, _ := cpuid(7, 0) 32 + X86.HasAVX2 = osSupportsAVX && ecx1&cpuidAVX != 0 && ebx7&cpuidAVX2 != 0 33 + }
+22
internal/cpu/cpu_amd64.s
··· 1 + //go:build amd64 && !purego 2 + 3 + #include "textflag.h" 4 + 5 + // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) 6 + TEXT ·cpuid(SB), NOSPLIT, $0-24 7 + MOVL eaxArg+0(FP), AX 8 + MOVL ecxArg+4(FP), CX 9 + CPUID 10 + MOVL AX, eax+8(FP) 11 + MOVL BX, ebx+12(FP) 12 + MOVL CX, ecx+16(FP) 13 + MOVL DX, edx+20(FP) 14 + RET 15 + 16 + // func xgetbv() (eax, edx uint32) 17 + TEXT ·xgetbv(SB), NOSPLIT, $0-8 18 + MOVL $0, CX 19 + XGETBV 20 + MOVL AX, eax+0(FP) 21 + MOVL DX, edx+4(FP) 22 + RET
+3
internal/cpu/cpu_other.go
··· 1 + //go:build !amd64 || purego 2 + 3 + package cpu