Source file src/math/big/arith_decl.go
1 // Copyright 2010 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 //go:build !math_big_pure_go 6 7 //go:generate go test ./internal/asmgen -generate 8 9 package big 10 11 import _ "unsafe" // for linkname 12 13 // implemented in arith_$GOARCH.s 14 15 // addVV should be an internal detail, 16 // but widely used packages access it using linkname. 17 // Notable members of the hall of shame include: 18 // - github.com/remyoudompheng/bigfft 19 // 20 // Do not remove or change the type signature. 21 // See go.dev/issue/67401. 22 // 23 //go:linkname addVV 24 //go:noescape 25 func addVV(z, x, y []Word) (c Word) 26 27 // subVV should be an internal detail, 28 // but widely used packages access it using linkname. 29 // Notable members of the hall of shame include: 30 // - github.com/remyoudompheng/bigfft 31 // 32 // Do not remove or change the type signature. 33 // See go.dev/issue/67401. 34 // 35 //go:linkname subVV 36 //go:noescape 37 func subVV(z, x, y []Word) (c Word) 38 39 // shlVU should be an internal detail (and a stale one at that), 40 // but widely used packages access it using linkname. 41 // Notable members of the hall of shame include: 42 // - github.com/remyoudompheng/bigfft 43 // 44 // Do not remove or change the type signature. 45 // See go.dev/issue/67401. 46 // 47 //go:linkname shlVU 48 func shlVU(z, x []Word, s uint) (c Word) { 49 if s == 0 { 50 copy(z, x) 51 return 0 52 } 53 return lshVU(z, x, s) 54 } 55 56 // lshVU sets z = x<<s, returning the high bits c. 1 ≤ s ≤ _B-1. 57 // 58 //go:noescape 59 func lshVU(z, x []Word, s uint) (c Word) 60 61 // rshVU sets z = x>>s, returning the low bits c. 1 ≤ s ≤ _B-1. 62 // 63 //go:noescape 64 func rshVU(z, x []Word, s uint) (c Word) 65 66 // mulAddVWW should be an internal detail, 67 // but widely used packages access it using linkname. 68 // Notable members of the hall of shame include: 69 // - github.com/remyoudompheng/bigfft 70 // 71 // Do not remove or change the type signature. 72 // See go.dev/issue/67401. 73 // 74 //go:linkname mulAddVWW 75 //go:noescape 76 func mulAddVWW(z, x []Word, m, a Word) (c Word) 77 78 // addMulVVW should be an internal detail (and a stale one at that), 79 // but widely used packages access it using linkname. 80 // Notable members of the hall of shame include: 81 // - github.com/remyoudompheng/bigfft 82 // 83 // Do not remove or change the type signature. 84 // See go.dev/issue/67401. 85 // 86 //go:linkname addMulVVW 87 func addMulVVW(z, x []Word, y Word) (c Word) { 88 return addMulVVWW(z, z, x, y, 0) 89 } 90 91 // addMulVVWW sets z = x+y*m+a. 92 // 93 //go:noescape 94 func addMulVVWW(z, x, y []Word, m, a Word) (c Word) 95