Browse Source

Fix Rust examples for current nightly

Also remove trailing whitespaces.
dev/git-series/gccdum
Vinzent Steinberg 7 years ago
parent
commit
8c59c340c0
  1. 4
      examples/rust/max_array_opt.rs
  2. 4
      examples/rust/sum_over_array_opt.rs

4
examples/rust/max_array_opt.rs

@ -1,9 +1,9 @@
#![feature(core)]
#![feature(core_intrinsics)]
// Requires the use of the nightly rust
// Compile with -O
pub fn max_array(x: &mut[f64; 65536], y: &[f64; 65536]) {
unsafe {
std::intrinsics::assume(x.as_ptr() as usize % 64 == 0);
std::intrinsics::assume(x.as_ptr() as usize % 64 == 0);
std::intrinsics::assume(y.as_ptr() as usize % 64 == 0);
}
for i in 0..65536 {

4
examples/rust/sum_over_array_opt.rs

@ -1,9 +1,9 @@
#![feature(core)]
#![feature(core_intrinsics)]
// Requires the use of the nightly rust
// Compile with -O
pub fn sum_array(x: &[i32]) -> i32 {
unsafe {
std::intrinsics::assume(x.as_ptr() as usize % 64 == 0);
std::intrinsics::assume(x.as_ptr() as usize % 64 == 0);
}
x.iter().fold(0, |sum, next| sum + *next)
}

Loading…
Cancel
Save