Skip to content

Instantly share code, notes, and snippets.

@kellegous
Created March 18, 2013 02:23
Show Gist options
  • Save kellegous/5184564 to your computer and use it in GitHub Desktop.
Save kellegous/5184564 to your computer and use it in GitHub Desktop.
uint32_t FindMissing(uint32_t* arr) {
uint32_t res[4];
__m128i c = _mm_set1_epi32(0);
for (int i = 0; i < 100; i+=4) {
c = _mm_add_epi32(c,
_mm_loadu_si128((__m128i*)&arr[i]));
}
_mm_store_si128((__m128i*)res, c);
return 5050 - res[0] - res[1] - res[2] - res[3];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment