2016-04-21 14:35:39 -05:00
|
|
|
//@ compile-flags: -C no-prepopulate-passes -O
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// CHECK-LABEL: @zip_copy
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn zip_copy(xs: &[u8], ys: &mut [u8]) {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK: memcpy
|
2016-04-21 14:35:39 -05:00
|
|
|
for (x, y) in xs.iter().zip(ys) {
|
|
|
|
*y = *x;
|
|
|
|
}
|
|
|
|
}
|
2016-10-17 03:58:21 -05:00
|
|
|
|
|
|
|
// CHECK-LABEL: @zip_copy_mapped
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn zip_copy_mapped(xs: &[u8], ys: &mut [u8]) {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK: memcpy
|
2016-10-17 03:58:21 -05:00
|
|
|
for (x, y) in xs.iter().map(|&x| x).zip(ys) {
|
|
|
|
*y = x;
|
|
|
|
}
|
|
|
|
}
|