3 ms·
A few notes: 1. memcmp is in <string.h> 2. char is not the same as unsigned char 3. Compilers like to remove loops. Notice how there are no labels, and n
by kwillets 10y ago
A few notes:
1. memcmp is in <string.h>
2. char is not the same as unsigned char
3. Compilers like to remove loops. Notice how there are no labels, and no branches, in main here: https://godbolt.org/g/DCTBb7 https://godbolt.org/g/DCTBb7 .
4. There are benchmarks of various methods: http://0x80.pl/articles/simd-strfind.html http://0x80.pl/articles/simd-strfind.html .