diff --git a/zmq-sys/src/ffi.rs b/zmq-sys/src/ffi.rs index 17e37fc88..0f5037ad9 100644 --- a/zmq-sys/src/ffi.rs +++ b/zmq-sys/src/ffi.rs @@ -415,6 +415,7 @@ pub struct zmq_pollitem_t { pub revents: ::std::os::raw::c_short, } #[test] +#[cfg(target_pointer_width = "64")] fn bindgen_test_layout_zmq_pollitem_t() { assert_eq!( ::std::mem::size_of::(), @@ -467,6 +468,59 @@ fn bindgen_test_layout_zmq_pollitem_t() { ) ); } +#[cfg(not(target_pointer_width = "64"))] +fn bindgen_test_layout_zmq_pollitem_t() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(zmq_pollitem_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(zmq_pollitem_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).socket as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(zmq_pollitem_t), + "::", + stringify!(socket) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(zmq_pollitem_t), + "::", + stringify!(fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).events as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(zmq_pollitem_t), + "::", + stringify!(events) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).revents as *const _ as usize }, + 10usize, + concat!( + "Offset of field: ", + stringify!(zmq_pollitem_t), + "::", + stringify!(revents) + ) + ); +} impl Default for zmq_pollitem_t { fn default() -> Self { unsafe { ::std::mem::zeroed() }