Skip to main content

swap_byte_order

Function swap_byte_order 

Source
pub fn swap_byte_order(value: u64, width: u32) -> u64
Expand description

Reverses the byte order of a field, for leastSignificantByteFirst encodings.

The field is first read MSB-first as an integer; this then reverses the ceil(width / 8) bytes of that integer, which is what the reference implementation does and what little-endian on the wire means for a byte-aligned field.