2022-10-07 15:30:45 +08:00
|
|
|
package spec
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
maxSeqID = 0x3F
|
|
|
|
flagBitNode = 0x80
|
|
|
|
wipeFlagBits = 0x3F
|
|
|
|
msb = 0x80
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-10-07 15:41:18 +08:00
|
|
|
errInvalidSeqId = errors.New("coder.Builder: SeqId should >= 0 and =< 0x3F")
|
2022-10-07 15:30:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func readByte(reader io.Reader) (byte, error) {
|
|
|
|
var b [1]byte
|
|
|
|
n, err := reader.Read(b[:])
|
|
|
|
if n == 0 {
|
|
|
|
return 0x00, err
|
|
|
|
}
|
|
|
|
return b[0], err
|
|
|
|
}
|