diff --git a/tape/decode.go b/tape/decode.go index 990418b..9a2ad58 100644 --- a/tape/decode.go +++ b/tape/decode.go @@ -110,23 +110,6 @@ func (this *Decoder) ReadUintN(bytes int) (value uint64, n int, err error) { return value, n, nil } -// ReadGBEU decodes a growing unsigned integer of up to 64 bits from the input -// reader. -func (this *Decoder) ReadGBEU() (value uint64, n int, err error) { - var fullValue uint64 - for { - chunk, nn, err := this.ReadByte() - n += nn; if err != nil { return 0, n, err } - - fullValue *= 0x80 - fullValue += uint64(chunk & 0x7F) - ccb := chunk >> 7 - if ccb == 0 { - return fullValue, n, nil - } - } -} - // ReadFloat32 decldes a 32-bit floating point value from the input reader. func (this *Decoder) ReadFloat32() (value float32, n int, err error) { bits, nn, err := this.ReadUint32() diff --git a/tape/encode.go b/tape/encode.go index 878697a..8d225f0 100644 --- a/tape/encode.go +++ b/tape/encode.go @@ -99,27 +99,6 @@ func (this *Encoder) WriteUintN(value uint64, bytes int) (n int, err error) { return n, nil } -// EncodeGBEU encodes a growing unsigned integer of up to 64 bits to the output -// writer. -func (this *Encoder) EncodeGBEU(value uint64) (n int, err error) { - buffer := [16]byte { } - - window := (GBEUSize(value) - 1) * 7 - index := 0 - for window >= 0 { - chunk := uint8(value >> window) & 0x7F - if window > 0 { - chunk |= 0x80 - } - buffer[index] = chunk - - index += 1 - window -= 7 - } - - return this.Write(buffer[:]) -} - // WriteFloat32 encodes a 32-bit floating point value to the output writer. func (this *Encoder) WriteFloat32(value float32) (n int, err error) { return this.WriteUint32(math.Float32bits(value)) diff --git a/tape/measure.go b/tape/measure.go index ded5153..b57fd9d 100644 --- a/tape/measure.go +++ b/tape/measure.go @@ -1,15 +1,5 @@ package tape -// GBEUSize returns the size (in octets) of a GBEU integer. -func GBEUSize(value uint64) int { - length := 0 - for { - value >>= 7 - length ++ - if value == 0 { return length } - } -} - // IntBytes returns the number of bytes required to hold a given unsigned // integer. func IntBytes(value uint64) int {