1
0
mirror of https://github.com/fumiama/go-base16384.git synced 2026-06-05 00:32:52 +08:00

优化代码结构

This commit is contained in:
源文雨
2022-09-17 20:46:22 +08:00
parent b75d6ab6d8
commit d47127dc75

View File

@@ -6,20 +6,6 @@ import "encoding/binary"
func encodeGeneric(offset, outlen int, b, encd []byte) {
var n int
i := 0
if len(b) == 7 {
b = append(b, 0)
shift := binary.BigEndian.Uint64(b[i:]) >> 2
sum := shift
sum &= 0x3fff000000000000
shift >>= 2
sum |= shift & 0x00003fff00000000
shift >>= 2
sum |= shift & 0x000000003fff0000
shift >>= 2
sum |= shift & 0x0000000000003fff
sum += 0x4e004e004e004e00
binary.BigEndian.PutUint64(encd[n:], sum)
} else {
if len(b)%7 == 0 {
b = append(b, 0)
}
@@ -68,7 +54,6 @@ func encodeGeneric(offset, outlen int, b, encd []byte) {
encd[outlen-1] = byte(offset)
}
}
}
//go:nosplit
func decodeGeneric(offset, outlen int, b, decd []byte) {