Rivoreo Source Code Repositories
src.rivoreo.one
/
compiler-explorer
/
5b92f11e762f8e87a76eb7cef0dab7f0883f47cb
/
.
/
examples
/
rust
/
sum_over_array_opt.rs
blob: bea60968abf5df0029c7c76983b703e35662adbe [
file
] [
log
] [
blame
] [
raw
]
#[
allow
(
unstable
)]
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
)
}