Fix Rust examples for current nightly

Also remove trailing whitespaces.
This commit is contained in:
Vinzent Steinberg 2016-03-02 23:50:58 +01:00
parent 1c19ae2445
commit 8c59c340c0
2 changed files with 4 additions and 4 deletions

View File

@ -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 {

View File

@ -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)
}