You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
201 B

  1. package common
  2. // SwapEndianness swaps the order of the bytes in the slice.
  3. func SwapEndianness(b []byte) []byte {
  4. o := make([]byte, len(b))
  5. for i := range b {
  6. o[len(b)-1-i] = b[i]
  7. }
  8. return o
  9. }