mirror of
https://github.com/Noratrieb/advent-of-code.git
synced 2026-01-17 02:55:01 +01:00
AVX2
This commit is contained in:
parent
267b9e8c3d
commit
d5b8c4ed21
3 changed files with 155 additions and 1 deletions
|
|
@ -14,7 +14,12 @@ pub unsafe fn part2(input: &str) {
|
|||
// in the integer bytes:
|
||||
// X X X X X e n o
|
||||
// this out of bounds read is UB under SB, but fine under models that don't do provenance narrowing with slices. i dont care enough to fix it.
|
||||
let block = bytes.as_ptr().add(byte_idx).cast::<u64>().read_unaligned().to_le();
|
||||
let block = bytes
|
||||
.as_ptr()
|
||||
.add(byte_idx)
|
||||
.cast::<u64>()
|
||||
.read_unaligned()
|
||||
.to_le();
|
||||
|
||||
let one = (block & ((1 << (8 * 1)) - 1)) as u8;
|
||||
let three = block & ((1 << (8 * 3)) - 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue