Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vec4 color32_to_vec4(color32 color)
- {
- __m128 colorf = _mm_cvtpu8_ps(_mm_set_pi32(0.0f, color));
- colorf = _mm_shuffle_ps(colorf, colorf, 0x1B);
- return _mm_mul_ps(colorf, _mm_set1_ps(1.0f / 255.0f));
- }
- color32 vec4_to_color32(__m128 m)
- {
- m = _mm_shuffle_ps(m, m, 0x1B);
- return (_m_to_int(_mm_cvtps_pi8(_mm_mul_ps(m, _mm_set1_ps(127.0f)))) * 2) | _m_to_int(_mm_cvtps_pi8(m));
- }
Add Comment
Please, Sign In to add comment