Browse Source

fix build with Go 1.0 + branch optimization

inverted loop condition, so that in common case it matches the previous
branching result
Julien Schmidt 12 years ago
parent
commit
b494bacf0d
1 changed files with 3 additions and 3 deletions
  1. 3 3
      buffer.go

+ 3 - 3
buffer.go

@@ -42,10 +42,9 @@ func (b *buffer) fill(need int) (err error) {
 			b.buf = append(b.buf, 0)
 			b.buf = append(b.buf, 0)
 			b.buf = b.buf[:cap(b.buf)]
 			b.buf = b.buf[:cap(b.buf)]
 
 
-			if cap(b.buf) < need {
-				continue
+			if cap(b.buf) >= need {
+				break
 			}
 			}
-			break
 		}
 		}
 	}
 	}
 
 
@@ -61,6 +60,7 @@ func (b *buffer) fill(need int) (err error) {
 		}
 		}
 		return // err
 		return // err
 	}
 	}
+	return
 }
 }
 
 
 // returns next N bytes from buffer.
 // returns next N bytes from buffer.