Shorten endian conversion method names
The consensus on #14917 was that the proposed names were too long.
This commit is contained in:
parent
779ca97525
commit
cb8ca2dafd
9 changed files with 84 additions and 84 deletions
|
|
@ -27,10 +27,10 @@ use super::util;
|
|||
#[cfg(unix)] pub type sock_t = super::file::fd_t;
|
||||
|
||||
pub fn htons(u: u16) -> u16 {
|
||||
u.to_big_endian()
|
||||
u.to_be()
|
||||
}
|
||||
pub fn ntohs(u: u16) -> u16 {
|
||||
Int::from_big_endian(u)
|
||||
Int::from_be(u)
|
||||
}
|
||||
|
||||
enum InAddr {
|
||||
|
|
@ -46,7 +46,7 @@ fn ip_to_inaddr(ip: rtio::IpAddr) -> InAddr {
|
|||
(c as u32 << 8) |
|
||||
(d as u32 << 0);
|
||||
InAddr(libc::in_addr {
|
||||
s_addr: Int::from_big_endian(ip)
|
||||
s_addr: Int::from_be(ip)
|
||||
})
|
||||
}
|
||||
rtio::Ipv6Addr(a, b, c, d, e, f, g, h) => {
|
||||
|
|
@ -180,7 +180,7 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage,
|
|||
let storage: &libc::sockaddr_in = unsafe {
|
||||
mem::transmute(storage)
|
||||
};
|
||||
let ip = (storage.sin_addr.s_addr as u32).to_big_endian();
|
||||
let ip = (storage.sin_addr.s_addr as u32).to_be();
|
||||
let a = (ip >> 24) as u8;
|
||||
let b = (ip >> 16) as u8;
|
||||
let c = (ip >> 8) as u8;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue