Why is memcmp(a, b, size) so much faster than:
memcmp(a, b, size)
for(i = 0; i < nelements; i++) { if a[i] != b[i] return 0; } return 1;
I
Is memcmp a CPU instruction or something?
It is at least a very highly optimized compiler-provided intrinsic function. Possibly a single machine instruction, or two, depending on the platform, which you haven't specified.