Array intersections - part 3
In part1 we demonstrated that a very short C++ standard library approach could be a very poor way of finding an array intersection and went on to show the simple but reasonably efficient method mostly used. in part2 we showed how the special case of intersecting a short array with a long one would be better done by other means. Now we will try to go further, consider this piece of code. The github is here #include <cstdio> #include <xmmintrin.h> #include <stdint.h> #include <cstring> // bits set in the range of numbers 0 - 15 static uint32_t mask_count [ 16 ] = { 0 , 1 , 1 , 2 , 1 , 2 , 2 , 3 , 1 , 2 , 2 , 3 , 2 , 3 , 3 , 4 }; int main ( int args , char ** argc ) { uint32_t x [] = { 0 , 1 , 3 , 4 }; uint32_t y [] = { 1 , 2 , 3 , 6 }; // the functions that use this need it as a constant known at compile time #define rotate _MM_SHUFFLE ( 0 , 3 , 2 , 1 ) // load the array into a 128 bit variable __m128i a1 = _mm_loadu_si128 (( __m1...