tape: Add tag functions to the encoder
This commit is contained in:
parent
663cab6b77
commit
7b8240cec6
@ -140,3 +140,10 @@ func (this *Decoder) ReadFloat64() (value float64, n int, err error) {
|
||||
n += nn; if err != nil { return 0, n, err }
|
||||
return math.Float64frombits(bits), n, nil
|
||||
}
|
||||
|
||||
// ReadTag decodes a [Tag] from the input reader.
|
||||
func (this *Decoder) ReadTag() (value Tag, n int, err error) {
|
||||
uncasted, nn, err := this.ReadUint8()
|
||||
n += nn; if err != nil { return 0, n, err }
|
||||
return Tag(uncasted), n, nil
|
||||
}
|
||||
|
@ -129,3 +129,8 @@ func (this *Encoder) WriteFloat32(value float32) (n int, err error) {
|
||||
func (this *Encoder) WriteFloat64(value float64) (n int, err error) {
|
||||
return this.WriteUint64(math.Float64bits(value))
|
||||
}
|
||||
|
||||
// WriteTag encodes a [Tag] to the output writer.
|
||||
func (this *Encoder) WriteTag(value Tag) (n int, err error) {
|
||||
return this.WriteUint8(uint8(value))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user