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
59 changes: 28 additions & 31 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn bindgen_test_layout_umash_params() {
concat!("Alignment of ", stringify!(umash_params))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_params>())).poly as *const _ as usize },
::std::mem::offset_of!(umash_params, poly),
0usize,
concat!(
"Offset of field: ",
Expand All @@ -32,7 +32,7 @@ fn bindgen_test_layout_umash_params() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_params>())).oh as *const _ as usize },
::std::mem::offset_of!(umash_params, oh),
32usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -61,7 +61,7 @@ fn bindgen_test_layout_umash_fp() {
concat!("Alignment of ", stringify!(umash_fp))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_fp>())).hash as *const _ as usize },
::std::mem::offset_of!(umash_fp, hash),
0usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -113,7 +113,7 @@ fn bindgen_test_layout_umash_sink__bindgen_ty_1() {
concat!("Alignment of ", stringify!(umash_sink__bindgen_ty_1))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink__bindgen_ty_1>())).mul as *const _ as usize },
::std::mem::offset_of!(umash_sink__bindgen_ty_1, mul),
0usize,
concat!(
"Offset of field: ",
Expand All @@ -123,7 +123,7 @@ fn bindgen_test_layout_umash_sink__bindgen_ty_1() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink__bindgen_ty_1>())).acc as *const _ as usize },
::std::mem::offset_of!(umash_sink__bindgen_ty_1, acc),
16usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -151,7 +151,7 @@ fn bindgen_test_layout_umash_sink_umash_oh() {
concat!("Alignment of ", stringify!(umash_sink_umash_oh))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink_umash_oh>())).bits as *const _ as usize },
::std::mem::offset_of!(umash_sink_umash_oh, bits),
0usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -181,7 +181,7 @@ fn bindgen_test_layout_umash_sink_umash_twisted_oh() {
concat!("Alignment of ", stringify!(umash_sink_umash_twisted_oh))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink_umash_twisted_oh>())).lrc as *const _ as usize },
::std::mem::offset_of!(umash_sink_umash_twisted_oh, lrc),
0usize,
concat!(
"Offset of field: ",
Expand All @@ -191,9 +191,7 @@ fn bindgen_test_layout_umash_sink_umash_twisted_oh() {
)
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<umash_sink_umash_twisted_oh>())).prev as *const _ as usize
},
::std::mem::offset_of!(umash_sink_umash_twisted_oh, prev),
16usize,
concat!(
"Offset of field: ",
Expand All @@ -203,7 +201,7 @@ fn bindgen_test_layout_umash_sink_umash_twisted_oh() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink_umash_twisted_oh>())).acc as *const _ as usize },
::std::mem::offset_of!(umash_sink_umash_twisted_oh, acc),
32usize,
concat!(
"Offset of field: ",
Expand All @@ -226,7 +224,7 @@ fn bindgen_test_layout_umash_sink() {
concat!("Alignment of ", stringify!(umash_sink))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).poly_state as *const _ as usize },
::std::mem::offset_of!(umash_sink, poly_state),
0usize,
concat!(
"Offset of field: ",
Expand All @@ -236,7 +234,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).buf as *const _ as usize },
::std::mem::offset_of!(umash_sink, buf),
48usize,
concat!(
"Offset of field: ",
Expand All @@ -246,7 +244,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).oh as *const _ as usize },
::std::mem::offset_of!(umash_sink, oh),
80usize,
concat!(
"Offset of field: ",
Expand All @@ -256,7 +254,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).oh_iter as *const _ as usize },
::std::mem::offset_of!(umash_sink, oh_iter),
88usize,
concat!(
"Offset of field: ",
Expand All @@ -266,7 +264,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).bufsz as *const _ as usize },
::std::mem::offset_of!(umash_sink, bufsz),
92usize,
concat!(
"Offset of field: ",
Expand All @@ -276,7 +274,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).block_size as *const _ as usize },
::std::mem::offset_of!(umash_sink, block_size),
93usize,
concat!(
"Offset of field: ",
Expand All @@ -286,7 +284,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).large_umash as *const _ as usize },
::std::mem::offset_of!(umash_sink, large_umash),
94usize,
concat!(
"Offset of field: ",
Expand All @@ -296,7 +294,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).hash_wanted as *const _ as usize },
::std::mem::offset_of!(umash_sink, hash_wanted),
95usize,
concat!(
"Offset of field: ",
Expand All @@ -306,7 +304,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).oh_acc as *const _ as usize },
::std::mem::offset_of!(umash_sink, oh_acc),
96usize,
concat!(
"Offset of field: ",
Expand All @@ -316,7 +314,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).oh_twisted as *const _ as usize },
::std::mem::offset_of!(umash_sink, oh_twisted),
112usize,
concat!(
"Offset of field: ",
Expand All @@ -326,7 +324,7 @@ fn bindgen_test_layout_umash_sink() {
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_sink>())).seed as *const _ as usize },
::std::mem::offset_of!(umash_sink, seed),
160usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -357,7 +355,7 @@ fn bindgen_test_layout_umash_state() {
concat!("Alignment of ", stringify!(umash_state))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_state>())).sink as *const _ as usize },
::std::mem::offset_of!(umash_state, sink),
0usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -387,7 +385,7 @@ fn bindgen_test_layout_umash_fp_state() {
concat!("Alignment of ", stringify!(umash_fp_state))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<umash_fp_state>())).sink as *const _ as usize },
::std::mem::offset_of!(umash_fp_state, sink),
0usize,
concat!(
"Offset of field: ",
Expand Down Expand Up @@ -429,7 +427,7 @@ extern "C" {
pub fn umash_sink_update(
arg1: *mut umash_sink,
data: *const ::std::os::raw::c_void,
n_bytes: ::std::os::raw::c_ulong,
n_bytes: usize,
);
}
extern "C" {
Expand All @@ -446,7 +444,7 @@ extern "C" {
seed: u64,
which: ::std::os::raw::c_int,
data: *const ::std::os::raw::c_void,
n_bytes: ::std::os::raw::c_ulong,
n_bytes: usize,
) -> u64;
}
extern "C" {
Expand All @@ -459,7 +457,7 @@ extern "C" {
params: *const umash_params,
seed: u64,
data: *const ::std::os::raw::c_void,
n_bytes: ::std::os::raw::c_ulong,
n_bytes: usize,
) -> umash_fp;
}
extern "C" {
Expand Down Expand Up @@ -492,7 +490,6 @@ extern "C" {
mod tests {
use crate::{umash_fp, umash_fprint, umash_full, umash_params, umash_params_derive};
use std::ffi::CString;
use std::os::raw::c_ulong;
use std::os::raw::c_void;

#[test]
Expand All @@ -511,7 +508,7 @@ mod tests {
&my_params,
seed,
input.as_bytes().as_ptr() as *const c_void,
input.as_bytes().len() as c_ulong,
input.as_bytes().len(),
)
};
assert_eq!(fprint.hash, [0x398c5bb5cc113d03, 0x3a52693519575aba]);
Expand All @@ -522,7 +519,7 @@ mod tests {
seed,
0,
input.as_bytes().as_ptr() as *const c_void,
input.as_bytes().len() as c_ulong,
input.as_bytes().len(),
)
};
assert_eq!(hash0, 0x398c5bb5cc113d03);
Expand All @@ -533,7 +530,7 @@ mod tests {
seed,
1,
input.as_bytes().as_ptr() as *const c_void,
input.as_bytes().len() as c_ulong,
input.as_bytes().len(),
)
};
assert_eq!(hash1, 0x3a52693519575aba);
Expand Down