Skip to content

Instantly share code, notes, and snippets.

@treed
treed / try-sse.c
Created September 26, 2011 09:59
Using packed string compare from SSE4.2 to search for certain characters
#include <smmintrin.h>
typedef union __attribute__((aligned(16))) {
unsigned char bytes[16];
__m128i vec;
} vec_bytes_128;
int main() {
int length = 3;
vec_bytes_128 in = { 'a', 'e', 'e', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };