Skip to content

Commit c1b8dca

Browse files
committed
fix build with Go 1.0 + branch optimization
inverted loop condition, so that in common case it matches the previous branching result
1 parent 49f2a41 commit c1b8dca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

buffer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ func (b *buffer) fill(need int) (err error) {
4242
b.buf = append(b.buf, 0)
4343
b.buf = b.buf[:cap(b.buf)]
4444

45-
if cap(b.buf) < need {
46-
continue
45+
if cap(b.buf) >= need {
46+
break
4747
}
48-
break
4948
}
5049
}
5150

@@ -61,6 +60,7 @@ func (b *buffer) fill(need int) (err error) {
6160
}
6261
return // err
6362
}
63+
return
6464
}
6565

6666
// returns next N bytes from buffer.

0 commit comments

Comments
 (0)