Rivoreo Source Code Repositories
src.rivoreo.one
/
compiler-explorer
/
400e553116b76745822f2fdabfff85c1911b58b6
/
.
/
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
)
}