Skip to content

Commit

Permalink
Fixed reverse function
Browse files Browse the repository at this point in the history
  • Loading branch information
Naveen Venkatesan committed Aug 2, 2022
1 parent 2514e7c commit f5e2511
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,9 @@ func (p *Payload) PackLittleEndian() *big.Int {
// Reverse byte array for little endian signals.
func reverse(data []byte) []byte {
reversedArray := make([]byte, len(data))
for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 {
reversedArray[i], reversedArray[j] = data[j], data[i]
copy(reversedArray, data)
for i, j := 0, len(reversedArray)-1; i < j; i, j = i+1, j-1 {
reversedArray[i], reversedArray[j] = reversedArray[j], reversedArray[i]
}
return reversedArray
}
Expand Down

0 comments on commit f5e2511

Please sign in to comment.