Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C" {
pub fn freeifaddrs(ifa: *mut ifaddrs) -> c_void;
}

fn make_int16(lo: u8, hi: u8) -> u16 {
fn make_int16(hi: u8, lo: u8) -> u16 {
(lo as u16) | ((hi as u16) << 8)
}

Expand Down Expand Up @@ -107,3 +107,13 @@ extern "C" {
#[cfg(target_os = "macos")]
pub fn rust_LLADDR(p: *mut ifaddrs) -> *const u8;
}

#[cfg(test)]
mod tests {
use super::make_int16;

#[test]
fn test_make_int16() {
assert_eq!(make_int16(0xff, 0x00), 0xff00);
}
}