mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
15 lines
320 B
Go
15 lines
320 B
Go
|
/*
|
||
|
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
|
||
|
}
|