1
1
mirror of https://github.com/wader/fq.git synced 2024-09-11 12:05:39 +03:00

Merge pull request #908 from wader/decode-align-structs

decode: Align some heavily used structs to save space
This commit is contained in:
Mattias Wadman 2024-04-01 18:25:08 +02:00 committed by GitHub
commit 4ac96a67e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,26 +12,26 @@ import (
)
type Compound struct {
IsArray bool
Children []*Value
ByName map[string]*Value
Description string
Children []*Value
IsArray bool
}
// TODO: Encoding, u16le, varint etc, encode?
// TODO: Value/Compound interface? can have per type and save memory
// TODO: Make some fields optional somehow? map/slice?
type Value struct {
Parent *Value
Name string
V any // scalar.S or Compound (array/struct)
Index int // index in parent array/struct
Range ranges.Range
RootReader bitio.ReaderAtSeeker
IsRoot bool // TODO: rework?
Format *Format // TODO: rework
Description string
Err error
Parent *Value
Format *Format // TODO: rework
Name string
Description string
Range ranges.Range
Index int // index in parent array/struct
IsRoot bool // TODO: rework?
}
type WalkFn func(v *Value, rootV *Value, depth int, rootDepth int) error