> I’m a total .NET noob, but this attempt in Compiler Explorer shows it not using the xor trick.
It better not. The CLR trick introduces a data dependency that slows down the code on modern CPUs.
Compilers sometimes also can compile this down to zero instructions. Nothing says the variable-to-register mapping has to be constant in a single function.
It better not. The CLR trick introduces a data dependency that slows down the code on modern CPUs.
Compilers sometimes also can compile this down to zero instructions. Nothing says the variable-to-register mapping has to be constant in a single function.