Added the ability to convert the number directly to an array.
Sometimes it is better to not deal with endianess.
This commit is contained in:
@ -505,8 +505,8 @@ pub fn network_to_platform_order<T>(val: T) -> T
|
||||
else
|
||||
{
|
||||
// Convert the value from Big endian to Little endian.
|
||||
buffer = val.to_bytes(Endianess::Network);
|
||||
T::from_bytes(buffer.as_slice(), Endianess::Platform)
|
||||
buffer = val.to_endian_bytes(Endianess::Network);
|
||||
T::from_endian_bytes(buffer.as_slice(), Endianess::Platform)
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,8 +526,8 @@ pub fn platform_to_network_order<T>(val: T) -> T
|
||||
else
|
||||
{
|
||||
// Convert the value from Little endian to Big endian.
|
||||
buffer = val.to_bytes(Endianess::Platform);
|
||||
T::from_bytes(buffer.as_slice(), Endianess::Network)
|
||||
buffer = val.to_endian_bytes(Endianess::Platform);
|
||||
T::from_endian_bytes(buffer.as_slice(), Endianess::Network)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user