diff --git a/base14_amd64.go b/base14_amd64.go index 80675d6..b6c8aa5 100644 --- a/base14_amd64.go +++ b/base14_amd64.go @@ -9,7 +9,7 @@ import ( //go:noescape //go:nosplit -func _encode(offset, outlen int, b, encd []byte) (sum uint64, n uint64) +func _encode(offset int, b, encd []byte) (sum uint64, n uint64) //go:noescape //go:nosplit @@ -17,10 +17,7 @@ func _decode(offset, outlen int, b, decd []byte) func encode(offset, outlen int, b, encd []byte) { if movbe { - if len(b) == 7 { - b = append(b, 0) - } - sum, n := _encode(offset, outlen, b, encd) + sum, n := _encode(offset, b, encd) if offset == 0 { return } @@ -36,9 +33,6 @@ func encode(offset, outlen int, b, encd []byte) { func decode(offset, outlen int, b, decd []byte) { if movbe { - if offset != 0 && cap(b) == len(b) { - b = append(b, make([]byte, 8)...) - } _decode(offset, outlen, b, decd) } else { decodeGeneric(offset, outlen, b, decd) diff --git a/base14_amd64.s b/base14_amd64.s index 29eadda..f345288 100644 --- a/base14_amd64.s +++ b/base14_amd64.s @@ -3,13 +3,12 @@ #include "textflag.h" -// func _encode(offset, outlen int, b, encd []byte) (sum uint64, n uint64) -TEXT ·_encode(SB), NOSPLIT, $0-81 +// func _encode(offset int, b, encd []byte) (sum uint64, n uint64) +TEXT ·_encode(SB), NOSPLIT, $0-72 MOVQ ·offset+0(FP), R10 - MOVQ ·outlen+8(FP), AX - MOVQ ·data+16(FP), DI - MOVQ ·dlen+24(FP), R8 - MOVQ ·encd+40(FP), R9 + MOVQ ·data+8(FP), DI + MOVQ ·dlen+16(FP), R8 + MOVQ ·encd+32(FP), R9 XORQ CX, CX XORQ SI, SI SUBQ $6, R8 @@ -117,8 +116,8 @@ encsav: MOVQ $21955383195992142, CX ADDQ CX, DX SHLQ $3, SI - MOVQ DX, ·sum+64(FP) - MOVQ SI, ·n+72(FP) + MOVQ DX, ·sum+56(FP) + MOVQ SI, ·n+64(FP) encend: RET