tape: Fix table decoding restarting after each pull

This commit is contained in:
Sasha Koshka 2025-05-18 16:34:08 -04:00
parent 37c3e49833
commit dd5325b351

View File

@ -9,7 +9,8 @@ type TablePushFunc func(tag uint16, value []byte) (n int, err error)
type TablePullFunc func() (tag uint16, value []byte, n int, err error)
func DecodeTable(data []byte) TablePullFunc {
return func() (tag uint16, value []byte, n int, err error) {
n := 0
return func() (tag uint16, value []byte, n_ int, err error) {
tag, nn, err := DecodeI16[uint16](data[n:])
if err != nil { return tag, value, n, err }
n += nn