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:
2016-12-21 04:22:31 -05:00
parent 47e1c707eb
commit 04c94db9f5
2 changed files with 526 additions and 62 deletions

View File

@ -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)
}
}