newpieces capacity optimize

This commit is contained in:
Alexey Kostin 2017-12-30 18:20:59 +03:00
parent 9abe68d02d
commit 4b6c569de8

2
b2q.go
View File

@ -59,7 +59,7 @@ func gethash(info map[string]interface{}) (hash string) {
}
func piecesconvert(s string) []byte {
var newpieces = make([]byte, 0 , len(s))
var newpieces = make([]byte, 0 , len(s) * 8)
for _, c := range []byte(s) {
var binString string
binString = fmt.Sprintf("%s%.8b", binString, c)