twoway/
util.rs

1
2
3/*
4pub fn slice_eq(a: &[u8], b: &[u8]) -> bool {
5    // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
6    #[allow(improper_ctypes)]
7    extern { fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32; }
8    a.len() == b.len() && unsafe {
9        memcmp(a.as_ptr(),
10               b.as_ptr(),
11               a.len()) == 0
12    }
13}
14*/