FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Write byte directly without casting to byte slice · rogusdev/countbits@201f885 · GitHub

Commit 201f885

Browse files
committed
Write byte directly without casting to byte slice
1 parent 907efea commit 201f885

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎countbits/go/countbits.go‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ func main() {
7575
c += byte((j & b[i]) >> i)
7676
}
7777

78-
// https://stackoverflow.com/questions/16888357/convert-an-integer-to-a-byte-array
79-
//bs := make([]byte, 4)
80-
//binary.LittleEndian.PutUint32(bs, 31415926)
81-
82-
_, err := w.Write([]byte{c})
78+
err := w.WriteByte(c)
8379
if err != nil {
8480
panic(err)
8581
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL