Skip to content

Instantly share code, notes, and snippets.

@iamgreaser
Created July 25, 2014 04:39
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 iamgreaser/5761539adca572365663 to your computer and use it in GitHub Desktop.
Save iamgreaser/5761539adca572365663 to your computer and use it in GitHub Desktop.
Am I documenting my code right
static uint32_t color_sse_to_bytes_1(__m128 m)
{
// Introducing a new, novel way of documenting code!
__m128 multiply_by_255 = _mm_mul_ps(m, _mm_set1_ps(255.0f));
__m128i then_convert_to_int = _mm_cvtps_epi32(multiply_by_255);
__m128i pack_once = _mm_packs_epi32(then_convert_to_int, then_convert_to_int);
__m128i pack_again = _mm_packus_epi16(pack_once, pack_once);
int get_the_int_and_return = _mm_cvtsi128_si32(pack_again);
return get_the_int_and_return;
// I get the feeling that was a terrible idea.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment