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)
| 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. |
| 467 | func 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 | } |
no outgoing calls
no test coverage detected