twoway/
util.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14


/*
pub fn slice_eq(a: &[u8], b: &[u8]) -> bool {
    // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
    #[allow(improper_ctypes)]
    extern { fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32; }
    a.len() == b.len() && unsafe {
        memcmp(a.as_ptr(),
               b.as_ptr(),
               a.len()) == 0
    }
}
*/