We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3abc633 commit 19d8ab8Copy full SHA for 19d8ab8
src/libnative/io/net.rs
@@ -26,15 +26,11 @@ use super::file::keep_going;
26
#[cfg(windows)] pub type sock_t = libc::SOCKET;
27
#[cfg(unix)] pub type sock_t = super::file::fd_t;
28
29
-#[cfg(target_endian = "big")] pub fn htons(x: u16) -> u16 { x }
30
-#[cfg(target_endian = "big")] pub fn ntohs(x: u16) -> u16 { x }
31
-#[cfg(target_endian = "little")]
32
pub fn htons(u: u16) -> u16 {
33
- unsafe { intrinsics::bswap16(u as i16) as u16 }
+ intrinsics::to_be16(u as i16) as u16
34
}
35
36
pub fn ntohs(u: u16) -> u16 {
37
+ intrinsics::from_be16(u as i16) as u16
38
39
40
enum InAddr {
0 commit comments