util: move ArrayReverse into package of its own
Leave just uint160 and uint256 types in util.
This commit is contained in:
parent
588f3fbbd3
commit
100e97d772
8 changed files with 28 additions and 21 deletions
14
pkg/util/slice/array.go
Normal file
14
pkg/util/slice/array.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
Package slice contains byte slice helpers.
|
||||
*/
|
||||
package slice
|
||||
|
||||
// CopyReverse returns a new byte slice containing reversed version of the
|
||||
// original.
|
||||
func CopyReverse(b []byte) []byte {
|
||||
dest := make([]byte, len(b))
|
||||
for i, j := 0, len(b)-1; i <= j; i, j = i+1, j-1 {
|
||||
dest[i], dest[j] = b[j], b[i]
|
||||
}
|
||||
return dest
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue