mirror of
https://github.com/golang/go
synced 2024-11-25 11:57:58 -07:00
big, bytes: move assembly externs to separate file
to make it easier to build package without assembly. R=r, r2 CC=golang-dev https://golang.org/cl/1680045
This commit is contained in:
parent
f374575fb7
commit
44ca04d3d6
@ -7,6 +7,7 @@ include ../../Make.$(GOARCH)
|
|||||||
TARG=big
|
TARG=big
|
||||||
GOFILES=\
|
GOFILES=\
|
||||||
arith.go\
|
arith.go\
|
||||||
|
arith_decl.go\
|
||||||
int.go\
|
int.go\
|
||||||
nat.go\
|
nat.go\
|
||||||
rat.go\
|
rat.go\
|
||||||
|
@ -56,7 +56,6 @@ func subWW_g(x, y, c Word) (z1, z0 Word) {
|
|||||||
|
|
||||||
|
|
||||||
// z1<<_W + z0 = x*y
|
// z1<<_W + z0 = x*y
|
||||||
func mulWW(x, y Word) (z1, z0 Word)
|
|
||||||
func mulWW_g(x, y Word) (z1, z0 Word) {
|
func mulWW_g(x, y Word) (z1, z0 Word) {
|
||||||
// Split x and y into 2 halfWords each, multiply
|
// Split x and y into 2 halfWords each, multiply
|
||||||
// the halfWords separately while avoiding overflow,
|
// the halfWords separately while avoiding overflow,
|
||||||
@ -243,7 +242,6 @@ func leadingZeros(x Word) uint {
|
|||||||
|
|
||||||
|
|
||||||
// q = (x1<<_W + x0 - r)/y
|
// q = (x1<<_W + x0 - r)/y
|
||||||
func divWW(x1, x0, y Word) (q, r Word)
|
|
||||||
func divWW_g(x1, x0, y Word) (q, r Word) {
|
func divWW_g(x1, x0, y Word) (q, r Word) {
|
||||||
if x1 == 0 {
|
if x1 == 0 {
|
||||||
q, r = x0/y, x0%y
|
q, r = x0/y, x0%y
|
||||||
@ -286,7 +284,6 @@ func divWW_g(x1, x0, y Word) (q, r Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func addVV(z, x, y []Word) (c Word)
|
|
||||||
func addVV_g(z, x, y []Word) (c Word) {
|
func addVV_g(z, x, y []Word) (c Word) {
|
||||||
for i := range z {
|
for i := range z {
|
||||||
c, z[i] = addWW_g(x[i], y[i], c)
|
c, z[i] = addWW_g(x[i], y[i], c)
|
||||||
@ -295,7 +292,6 @@ func addVV_g(z, x, y []Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func subVV(z, x, y []Word) (c Word)
|
|
||||||
func subVV_g(z, x, y []Word) (c Word) {
|
func subVV_g(z, x, y []Word) (c Word) {
|
||||||
for i := range z {
|
for i := range z {
|
||||||
c, z[i] = subWW_g(x[i], y[i], c)
|
c, z[i] = subWW_g(x[i], y[i], c)
|
||||||
@ -304,7 +300,6 @@ func subVV_g(z, x, y []Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func addVW(z, x []Word, y Word) (c Word)
|
|
||||||
func addVW_g(z, x []Word, y Word) (c Word) {
|
func addVW_g(z, x []Word, y Word) (c Word) {
|
||||||
c = y
|
c = y
|
||||||
for i := range z {
|
for i := range z {
|
||||||
@ -314,7 +309,6 @@ func addVW_g(z, x []Word, y Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func subVW(z, x []Word, y Word) (c Word)
|
|
||||||
func subVW_g(z, x []Word, y Word) (c Word) {
|
func subVW_g(z, x []Word, y Word) (c Word) {
|
||||||
c = y
|
c = y
|
||||||
for i := range z {
|
for i := range z {
|
||||||
@ -324,7 +318,6 @@ func subVW_g(z, x []Word, y Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func shlVW(z, x []Word, s Word) (c Word)
|
|
||||||
func shlVW_g(z, x []Word, s Word) (c Word) {
|
func shlVW_g(z, x []Word, s Word) (c Word) {
|
||||||
if n := len(z); n > 0 {
|
if n := len(z); n > 0 {
|
||||||
ŝ := _W - s
|
ŝ := _W - s
|
||||||
@ -341,7 +334,6 @@ func shlVW_g(z, x []Word, s Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func shrVW(z, x []Word, s Word) (c Word)
|
|
||||||
func shrVW_g(z, x []Word, s Word) (c Word) {
|
func shrVW_g(z, x []Word, s Word) (c Word) {
|
||||||
if n := len(z); n > 0 {
|
if n := len(z); n > 0 {
|
||||||
ŝ := _W - s
|
ŝ := _W - s
|
||||||
@ -358,7 +350,6 @@ func shrVW_g(z, x []Word, s Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func mulAddVWW(z, x []Word, y, r Word) (c Word)
|
|
||||||
func mulAddVWW_g(z, x []Word, y, r Word) (c Word) {
|
func mulAddVWW_g(z, x []Word, y, r Word) (c Word) {
|
||||||
c = r
|
c = r
|
||||||
for i := range z {
|
for i := range z {
|
||||||
@ -368,7 +359,6 @@ func mulAddVWW_g(z, x []Word, y, r Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func addMulVVW(z, x []Word, y Word) (c Word)
|
|
||||||
func addMulVVW_g(z, x []Word, y Word) (c Word) {
|
func addMulVVW_g(z, x []Word, y Word) (c Word) {
|
||||||
for i := range z {
|
for i := range z {
|
||||||
z1, z0 := mulAddWWW_g(x[i], y, z[i])
|
z1, z0 := mulAddWWW_g(x[i], y, z[i])
|
||||||
@ -379,7 +369,6 @@ func addMulVVW_g(z, x []Word, y Word) (c Word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func divWVW(z []Word, xn Word, x []Word, y Word) (r Word)
|
|
||||||
func divWVW_g(z []Word, xn Word, x []Word, y Word) (r Word) {
|
func divWVW_g(z []Word, xn Word, x []Word, y Word) (r Word) {
|
||||||
r = xn
|
r = xn
|
||||||
for i := len(z) - 1; i >= 0; i-- {
|
for i := len(z) - 1; i >= 0; i-- {
|
||||||
|
18
src/pkg/big/arith_decl.go
Normal file
18
src/pkg/big/arith_decl.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright 2010 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package big
|
||||||
|
|
||||||
|
// implemented in arith_$GOARCH.s
|
||||||
|
func mulWW(x, y Word) (z1, z0 Word)
|
||||||
|
func divWW(x1, x0, y Word) (q, r Word)
|
||||||
|
func addVV(z, x, y []Word) (c Word)
|
||||||
|
func subVV(z, x, y []Word) (c Word)
|
||||||
|
func addVW(z, x []Word, y Word) (c Word)
|
||||||
|
func subVW(z, x []Word, y Word) (c Word)
|
||||||
|
func shlVW(z, x []Word, s Word) (c Word)
|
||||||
|
func shrVW(z, x []Word, s Word) (c Word)
|
||||||
|
func mulAddVWW(z, x []Word, y, r Word) (c Word)
|
||||||
|
func addMulVVW(z, x []Word, y Word) (c Word)
|
||||||
|
func divWVW(z []Word, xn Word, x []Word, y Word) (r Word)
|
@ -8,6 +8,7 @@ TARG=bytes
|
|||||||
GOFILES=\
|
GOFILES=\
|
||||||
buffer.go\
|
buffer.go\
|
||||||
bytes.go\
|
bytes.go\
|
||||||
|
bytes_decl.go\
|
||||||
|
|
||||||
OFILES=\
|
OFILES=\
|
||||||
asm_$(GOARCH).$O\
|
asm_$(GOARCH).$O\
|
||||||
|
@ -103,9 +103,6 @@ func Index(s, sep []byte) int {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
|
|
||||||
func IndexByte(s []byte, c byte) int // asm_$GOARCH.s
|
|
||||||
|
|
||||||
func indexBytePortable(s []byte, c byte) int {
|
func indexBytePortable(s []byte, c byte) int {
|
||||||
for i, b := range s {
|
for i, b := range s {
|
||||||
if b == c {
|
if b == c {
|
||||||
|
8
src/pkg/bytes/bytes_decl.go
Normal file
8
src/pkg/bytes/bytes_decl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Copyright 2010 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package bytes
|
||||||
|
|
||||||
|
// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.
|
||||||
|
func IndexByte(s []byte, c byte) int // asm_$GOARCH.s
|
Loading…
Reference in New Issue
Block a user