mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 14:37:33 -06:00
This commit - formats the Rust examples idiomatically - uses idiomatic code - uses only safe code without compromising on performance - makes them compile on stable
9 lines
209 B
Rust
9 lines
209 B
Rust
// Compile with -C opt-level=3 -C target-cpu=native to see autovectorization
|
|
|
|
#[repr(align(64))]
|
|
pub struct Aligned<T: ?Sized>(T);
|
|
|
|
pub fn sum_array(input: &Aligned<[i32]>) -> i32 {
|
|
input.0.iter().sum()
|
|
}
|