Skip to content
Snippets Groups Projects
Commit 90feac95 authored by ale's avatar ale
Browse files

Avoid reading input one sample at a time in radioprober

Small costly mistake.
parent 66c4c620
No related branches found
No related tags found
No related merge requests found
......@@ -48,12 +48,6 @@ type floatReader struct {
io.Reader
}
func (r floatReader) ReadFloats(buf []float64) (n int, err error) {
for n = 0; n < len(buf); n++ {
err = binary.Read(r.Reader, binary.LittleEndian, &buf[n])
if err != nil {
break
}
}
return
func (r floatReader) ReadFloats(buf []float64) error {
return binary.Read(r.Reader, binary.LittleEndian, buf)
}
......@@ -127,8 +127,7 @@ func (p *Prober) stream() {
fr := &floatReader{dec}
buf := make([]float64, bufSize)
for {
_, err := fr.ReadFloats(buf)
if err != nil {
if err := fr.ReadFloats(buf); err != nil {
break
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment