And, the reason why I did not see what you were talking about is that you are looking at 64-bit sources, and not at 32-bit sources, as I was originally.
It turns out that the source code file has the #if directive in it. It performs different actions depending on whether the AMD64 symbol is defined at compile time.
Comments in the source code are very instructive. In principle, when compiling the framework for 64-bit platforms, they decided to deploy a loop of 12 and simultaneously check 3 quadwords . This is a performance optimization that is made possible by a different system architecture.
// unroll the loop #if AMD64 // for AMD64 bit platform we unroll by 12 and // check 3 qword at a time. This is less code // than the 32 bit case and is shorter pathlength while (length >= 12) { if (*(long*)a != *(long*)b) break; if (*(long*)(a+4) != *(long*)(b+4)) break; if (*(long*)(a+8) != *(long*)(b+8)) break; a += 12; b += 12; length -= 12; } #else while (length >= 10) { if (*(int*)a != *(int*)b) break; if (*(int*)(a+2) != *(int*)(b+2)) break; if (*(int*)(a+4) != *(int*)(b+4)) break; if (*(int*)(a+6) != *(int*)(b+6)) break; if (*(int*)(a+8) != *(int*)(b+8)) break; a += 10; b += 10; length -= 10; } #endif
If you are interested in the internal components of the .NET Framework, be sure to download the full version of the shared source from this site . You miss a lot of interesting things when you try to do this using only the .NET Reflector. Not the last of these are comments. And to think, I saw people arguing here that comments are not needed in well-written code!
source share