table: avoid unnecessary memory allocation about generating radix key

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2017-05-23 15:16:35 +09:00
parent 0ff4c8b20d
commit b4831ce8e9
+1 -1
View File
@@ -53,7 +53,7 @@ const (
func IpToRadixkey(b []byte, max uint8) string {
var buffer bytes.Buffer
for i := 0; i < len(b) && i < int(max); i++ {
buffer.WriteString(fmt.Sprintf("%08b", b[i]))
fmt.Fprintf(&buffer, "%08b", b[i])
}
return buffer.String()[:max]
}