about summary refs log tree commit diff
path: root/library/stdarch/examples/hex.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2021-03-25 10:11:30 -0500
committerGitHub <noreply@github.com>2021-03-25 15:11:30 +0000
commit3bbb381ac132f829de9478992d69bc698f6b7ece (patch)
tree27e3a380f23f34e41b04b3d27164b92fb2cd12a4 /library/stdarch/examples/hex.rs
parent770ced9a69a39c4bfc7e8af92a638e671a729873 (diff)
downloadrust-3bbb381ac132f829de9478992d69bc698f6b7ece.tar.gz
rust-3bbb381ac132f829de9478992d69bc698f6b7ece.zip
Tweak names of wasm SIMD intrinsics (#1096)
Diffstat (limited to 'library/stdarch/examples/hex.rs')
-rw-r--r--library/stdarch/examples/hex.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/library/stdarch/examples/hex.rs b/library/stdarch/examples/hex.rs
index edb1e129038..afefc44c368 100644
--- a/library/stdarch/examples/hex.rs
+++ b/library/stdarch/examples/hex.rs
@@ -159,21 +159,21 @@ unsafe fn hex_encode_sse41<'a>(mut src: &[u8], dst: &'a mut [u8]) -> Result<&'a
 unsafe fn hex_encode_simd128<'a>(mut src: &[u8], dst: &'a mut [u8]) -> Result<&'a str, usize> {
     use core_arch::arch::wasm32::*;
 
-    let ascii_zero = i8x16_splat(b'0' as i8);
-    let nines = i8x16_splat(9);
-    let ascii_a = i8x16_splat((b'a' - 9 - 1) as i8);
-    let and4bits = i8x16_splat(0xf);
+    let ascii_zero = u8x16_splat(b'0');
+    let nines = u8x16_splat(9);
+    let ascii_a = u8x16_splat(b'a' - 9 - 1);
+    let and4bits = u8x16_splat(0xf);
 
     let mut i = 0_isize;
     while src.len() >= 16 {
         let invec = v128_load(src.as_ptr() as *const _);
 
         let masked1 = v128_and(invec, and4bits);
-        let masked2 = v128_and(i8x16_shr_u(invec, 4), and4bits);
+        let masked2 = v128_and(u8x16_shr(invec, 4), and4bits);
 
         // return 0xff corresponding to the elements > 9, or 0x00 otherwise
-        let cmpmask1 = i8x16_gt_u(masked1, nines);
-        let cmpmask2 = i8x16_gt_u(masked2, nines);
+        let cmpmask1 = u8x16_gt(masked1, nines);
+        let cmpmask2 = u8x16_gt(masked2, nines);
 
         // add '0' or the offset depending on the masks
         let masked1 = i8x16_add(masked1, v128_bitselect(ascii_a, ascii_zero, cmpmask1));