MCPcopy Create free account
hub / github.com/DOSNetwork/core / reverse

Function reverse

group/mod/int.go:467–478  ·  view source on GitHub ↗

reverse copies src into dst in byte-reversed order and returns dst, such that src[0] goes into dst[len-1] and vice versa. dst and src may be the same slice but otherwise must not overlap.

(dst, src []byte)

Source from the content-addressed store, hash-verified

465// such that src[0] goes into dst[len-1] and vice versa.
466// dst and src may be the same slice but otherwise must not overlap.
467func reverse(dst, src []byte) []byte {
468 if dst == nil {
469 dst = make([]byte, len(src))
470 }
471 l := len(dst)
472 for i, j := 0, l-1; i < (l+1)/2; {
473 dst[i], dst[j] = src[j], src[i]
474 i++
475 j--
476 }
477 return dst
478}

Callers 3

UnmarshalBinaryMethod · 0.85
SetBytesMethod · 0.85
LittleEndianMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected