mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
audio/internal/convert: Avoid unnecessary allocations
This commit is contained in:
parent
569964d7e4
commit
c8ba51d26e
@ -61,7 +61,9 @@ func (f *f32Reader) Read(buf []byte) (int, error) {
|
|||||||
for ll < l {
|
for ll < l {
|
||||||
ll *= 2
|
ll *= 2
|
||||||
}
|
}
|
||||||
f.fbuf = make([]float32, ll)
|
if len(f.fbuf) < ll {
|
||||||
|
f.fbuf = make([]float32, ll)
|
||||||
|
}
|
||||||
|
|
||||||
n, err := f.r.Read(f.fbuf[:l])
|
n, err := f.r.Read(f.fbuf[:l])
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
|
Loading…
Reference in New Issue
Block a user