Skip to content

Instantly share code, notes, and snippets.

@dfyz
Last active February 16, 2020 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfyz/107e5b856bdccc8816489913431df5f5 to your computer and use it in GitHub Desktop.
Save dfyz/107e5b856bdccc8816489913431df5f5 to your computer and use it in GitHub Desktop.
fn do_test(x: usize) {
let arr = vec![vec![0u8; 3]];
let mut z = Vec::new();
for arr_ref in arr {
for y in 0..x {
for _ in 0..1 {
z.extend(std::iter::repeat(0).take(x));
let a = y * x;
let b = (y + 1) * x - 1;
let slice = &arr_ref[a..b];
eprintln!("{} {} {} {}", a, b, arr_ref.len(), slice.len());
let slice1 = &slice[0..(1 << 24)];
eprintln!("{:?}", slice1.last());
}
}
}
}
fn main() {
do_test(1);
do_test(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment