1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 #![feature(core_intrinsics)]
12 use std::intrinsics::{ volatile_copy_memory, volatile_store, volatile_load,
13 volatile_copy_nonoverlapping_memory,
14 volatile_set_memory };
17 let mut dst_pair = (1, 2);
18 let src_pair = (3, 4);
19 let mut dst_empty = ();
22 const COUNT_0: usize = 0;
23 const COUNT_100: usize = 100;
26 volatile_copy_memory(&mut dst_pair, &dst_pair, COUNT_0);
27 volatile_copy_nonoverlapping_memory(&mut dst_pair, &src_pair, 0);
28 volatile_copy_memory(&mut dst_empty, &dst_empty, 100);
29 volatile_copy_nonoverlapping_memory(&mut dst_empty, &src_empty,
31 volatile_set_memory(&mut dst_empty, 0, COUNT_100);
32 volatile_set_memory(&mut dst_pair, 0, COUNT_0);
33 volatile_store(&mut dst_empty, ());
34 volatile_store(&mut dst_empty, src_empty);
35 volatile_load(&src_empty);