[go: up one dir, main page]

Function bswap_copy

Source
pub const unsafe fn bswap_copy<T>(v: &T) -> T
Expand description

Creates a copy of v with the order of all bytes reversed.

Creates a copy of v and reverses the order of all bytes underlying the object. That is, its last byte will be swapped with the first, its second to last byte will be swapped with the second, and so on. In case of an odd number of bytes, the middle byte will stay untouched.

ยงSafety

The caller must guarantee that T remains valid after all bytes were copied and swapped.