mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-11-30 21:21:17 -06:00
10 lines
246 B
Rust
10 lines
246 B
Rust
#![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);
|
|
}
|
|
x.iter().fold(0, |sum, next| sum + *next)
|
|
}
|