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