2018-09-06 07:41:12 -05:00
|
|
|
// run-pass
|
2018-09-06 07:45:33 -05:00
|
|
|
#![allow(non_snake_case)]
|
2018-09-06 07:41:12 -05:00
|
|
|
|
2017-10-22 22:01:00 -05:00
|
|
|
// ignore-wasm32-bare no libc to test ffi with
|
|
|
|
|
2016-08-26 11:23:42 -05:00
|
|
|
#[derive(Clone, Copy)]
|
2016-08-26 11:23:42 -05:00
|
|
|
#[repr(C)]
|
|
|
|
struct LARGE_INTEGER_U {
|
|
|
|
LowPart: u32,
|
|
|
|
HighPart: u32,
|
|
|
|
}
|
|
|
|
|
2016-08-26 11:23:42 -05:00
|
|
|
#[derive(Clone, Copy)]
|
2016-08-26 11:23:42 -05:00
|
|
|
#[repr(C)]
|
|
|
|
union LARGE_INTEGER {
|
|
|
|
__unnamed__: LARGE_INTEGER_U,
|
|
|
|
u: LARGE_INTEGER_U,
|
|
|
|
QuadPart: u64,
|
|
|
|
}
|
|
|
|
|
2016-11-23 18:09:51 -06:00
|
|
|
#[link(name = "rust_test_helpers", kind = "static")]
|
2016-08-26 11:23:42 -05:00
|
|
|
extern "C" {
|
|
|
|
fn increment_all_parts(_: LARGE_INTEGER) -> LARGE_INTEGER;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
let mut li = LARGE_INTEGER { QuadPart: 0 };
|
|
|
|
let li_c = increment_all_parts(li);
|
|
|
|
li.__unnamed__.LowPart += 1;
|
|
|
|
li.__unnamed__.HighPart += 1;
|
|
|
|
li.u.LowPart += 1;
|
|
|
|
li.u.HighPart += 1;
|
|
|
|
li.QuadPart += 1;
|
|
|
|
assert_eq!(li.QuadPart, li_c.QuadPart);
|
|
|
|
}
|
|
|
|
}
|