Guest User

Untitled

a guest
Jun 22nd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. vec4 color32_to_vec4(color32 color)
  2. {
  3. __m128 colorf = _mm_cvtpu8_ps(_mm_set_pi32(0.0f, color));
  4. colorf = _mm_shuffle_ps(colorf, colorf, 0x1B);
  5. return _mm_mul_ps(colorf, _mm_set1_ps(1.0f / 255.0f));
  6. }
  7.  
  8. color32 vec4_to_color32(__m128 m)
  9. {
  10. m = _mm_shuffle_ps(m, m, 0x1B);
  11. return (_m_to_int(_mm_cvtps_pi8(_mm_mul_ps(m, _mm_set1_ps(127.0f)))) * 2) | _m_to_int(_mm_cvtps_pi8(m));
  12. }
Add Comment
Please, Sign In to add comment