Skip to content

Instantly share code, notes, and snippets.

@Nexuapex
Created February 18, 2012 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nexuapex/1857556 to your computer and use it in GitHub Desktop.
Save Nexuapex/1857556 to your computer and use it in GitHub Desktop.
Reinterpreting int ⇔ float with SSE
#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