Guest User

Untitled

a guest
Jul 15th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. use std::arch::x86_64::{_mm_loadu_si128, __m128i, _mm_cmpeq_epi8, _mm_set1_epi8, _mm_sub_epi8, _mm_and_si128, _mm_unpackhi_epi8, _mm_add_epi32, _mm_shufflelo_epi16};
  2. //use std::arch::x86::_MM_SHUFFLE;
  3. use std::arch::x86;
  4.  
  5. use std::mem;
  6.  
  7. fn main() {
  8. unsafe {
  9. //let t = _mm_set1_epi8(50);
  10. let q = _mm_set1_epi8(51);
  11.  
  12.  
  13. let hi8 = _mm_unpackhi_epi8(q, q);
  14.  
  15. let sum64 = _mm_add_epi32(hi8, q);
  16.  
  17. let hi32 = _mm_shufflelo_epi16(sum64, _MM_SHUFFLE(1, 0, 3, 2));
  18.  
  19. let arr: [u8; 16] = mem::transmute(hi32);
  20.  
  21. println!("{:?}", arr);
  22. }
  23.  
  24. println!("{} {}", 255 & 48, 255 - 48);
  25. }
  26.  
  27. /*
  28. 255 - 50 = 205
  29. 50 == 50 -> 255
  30.  
  31. 207 - 205 = 2
  32.  
  33.  
  34.  
  35.  
  36.  
  37. */
Add Comment
Please, Sign In to add comment