Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 673c879

Browse files
committed
avoid an unnecessary transmute
1 parent 65e7684 commit 673c879

File tree

1 file changed

+1
-1
lines changed
  • src/tools/miri/bench-cargo-miri/mse/src

1 file changed

+1
-1
lines changed

src/tools/miri/bench-cargo-miri/mse/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn read_i16(buffer: &[u8], index: usize) -> i16 {
1313
const SIZE: usize = size_of::<i16>();
1414
let mut bytes: [u8; SIZE] = [0u8; SIZE];
1515
bytes.copy_from_slice(&buffer[(index * SIZE)..(index * SIZE + SIZE)]);
16-
unsafe { std::mem::transmute(bytes) }
16+
i16::from_ne_bytes(bytes)
1717
}
1818

1919
fn mse(samples: usize, frame_buf: &[i16], buf_ref: &[u8]) -> f64 {

0 commit comments

Comments
 (0)