github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/bit/reflect.go (about) 1 package bit 2 3 import ( 4 "encoding/binary" 5 "io" 6 ) 7 8 func Write(w io.Writer, vs ...interface{}) error { 9 for _, v := range vs { 10 err := binary.Write(w, binary.LittleEndian, v) 11 if err != nil { 12 return err 13 } 14 } 15 return nil 16 } 17 18 func Read(r io.Reader, vs ...interface{}) error { 19 for _, v := range vs { 20 err := binary.Read(r, binary.LittleEndian, v) 21 if err != nil { 22 return err 23 } 24 } 25 return nil 26 }