If you're wondering why this is useful, the reason is buffer overflow exploits. Strings in C are null-terminated, so having a null in your code may stop it from getting copied.
I've used this in the past, in high performance math.
If you have data (vectors, matrices, etc.) that doesn't fit neatly into a SIMD block size, you'll have to zero out fields after the calculation. At this point, it's cheaper to generate a zero on the register than load via memory (cheaper as in the number of CPU instructions.)
6 comments
[ 2.1 ms ] story [ 40.2 ms ] threadIf you have data (vectors, matrices, etc.) that doesn't fit neatly into a SIMD block size, you'll have to zero out fields after the calculation. At this point, it's cheaper to generate a zero on the register than load via memory (cheaper as in the number of CPU instructions.)