1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-12 22:40:42 +08:00

fix generic panic, add movbe check

This commit is contained in:
源文雨
2022-09-17 20:38:32 +08:00
parent ceb3054caa
commit b75d6ab6d8
6 changed files with 90 additions and 43 deletions

View File

@@ -1,12 +1,9 @@
//go:build !amd64
// +build !amd64
package base14
import "encoding/binary"
//go:nosplit
func encode(offset, outlen int, b, encd []byte) {
func encodeGeneric(offset, outlen int, b, encd []byte) {
var n int
i := 0
if len(b) == 7 {
@@ -23,6 +20,9 @@ func encode(offset, outlen int, b, encd []byte) {
sum += 0x4e004e004e004e00
binary.BigEndian.PutUint64(encd[n:], sum)
} else {
if len(b)%7 == 0 {
b = append(b, 0)
}
for ; i <= len(b)-7; i += 7 {
shift := binary.BigEndian.Uint64(b[i:]) >> 2
sum := shift
@@ -71,7 +71,7 @@ func encode(offset, outlen int, b, encd []byte) {
}
//go:nosplit
func decode(offset, outlen int, b, decd []byte) {
func decodeGeneric(offset, outlen int, b, decd []byte) {
var n uintptr
i := 0
for ; i <= outlen-7; n += 8 {