Skip to content

Commit

Permalink
Simplify ReverseBits function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Oct 25, 2015
1 parent 5c1b7f0 commit a675e55
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ptypes/reversebits.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ func initReverseBitsTable() []uint16 {
// ReverseBits reverse bits in x.
func ReverseBits(x uint16) uint16 {
rx := uint64(x)
i := uint64(0)
for i < 16/2 {
for i := uint64(0); i < 16/2; i++ {
rx = SwapBits(rx, i, (15 - i))
i++
}
return uint16(rx)
}
Expand Down

0 comments on commit a675e55

Please sign in to comment.