Created
February 18, 2012 05:10
-
-
Save Nexuapex/1857556 to your computer and use it in GitHub Desktop.
Reinterpreting int ⇔ float with SSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <xmmintrin.h> | |
inline int as_int_bitwise(float a) | |
{ | |
return _mm_cvtsi128_si32(_mm_set_ss(a)); | |
} | |
inline float as_float_bitwise(int a) | |
{ | |
return _mm_cvtss_f32(_mm_cvtsi32_si128(a)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment