1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-21 19:48:08 +08:00

fix: amd64 asm read out of range

This commit is contained in:
fumiama
2022-08-22 13:11:31 +08:00
parent ebe73ccc6c
commit ceb3054caa
3 changed files with 40 additions and 14 deletions

View File

@@ -40,7 +40,7 @@ func Encode(b []byte) (encd []byte) {
outlen += 10
}
encd = make([]byte, outlen)
encode(offset, outlen, append(b, 0), encd)
encode(offset, outlen, b, encd)
return
}
@@ -62,7 +62,7 @@ func EncodeTo(b, encd []byte) error {
if len(encd) < outlen {
return errors.New("encd too small")
}
encode(offset, outlen, append(b, 0), encd)
encode(offset, outlen, b, encd)
return nil
}
@@ -105,7 +105,7 @@ func Decode(b []byte) (decd []byte) {
}
}
outlen = outlen/8*7 + offset
decd = make([]byte, outlen+1)
decd = make([]byte, outlen+8)
decode(offset, outlen, b, decd)
return decd[:outlen]
}