tape: Remove GBEU

This commit is contained in:
Sasha Koshka 2025-06-21 19:27:31 -04:00
parent 7b8240cec6
commit 65e8d51590
3 changed files with 0 additions and 48 deletions

View File

@ -110,23 +110,6 @@ func (this *Decoder) ReadUintN(bytes int) (value uint64, n int, err error) {
return value, n, nil 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. // ReadFloat32 decldes a 32-bit floating point value from the input reader.
func (this *Decoder) ReadFloat32() (value float32, n int, err error) { func (this *Decoder) ReadFloat32() (value float32, n int, err error) {
bits, nn, err := this.ReadUint32() bits, nn, err := this.ReadUint32()

View File

@ -99,27 +99,6 @@ func (this *Encoder) WriteUintN(value uint64, bytes int) (n int, err error) {
return n, nil 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. // WriteFloat32 encodes a 32-bit floating point value to the output writer.
func (this *Encoder) WriteFloat32(value float32) (n int, err error) { func (this *Encoder) WriteFloat32(value float32) (n int, err error) {
return this.WriteUint32(math.Float32bits(value)) return this.WriteUint32(math.Float32bits(value))

View File

@ -1,15 +1,5 @@
package tape 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 // IntBytes returns the number of bytes required to hold a given unsigned
// integer. // integer.
func IntBytes(value uint64) int { func IntBytes(value uint64) int {