9 ms·
TIL: .NET doesn't expose bitscan instructions.
by pkhuong 10y ago
TIL: .NET doesn't expose bitscan instructions.
- omgtehlion 10y agoWhen I needed these instructions, I created this https://github.com/omgtehlion/netintrinsics https://github.com/omgtehlion/netintrinsics Guys in OP seem to be more clever, though
- jongalloway2 10y agoFrom how I read this comment, it's not exposed on x86 because it's extremely slow on Atom: https://github.com/dotnet/coreclr/blob/cb9cbef5cd036bb7617202262908f358a46b47f8/src/inc/bitposition.h#L47 https://github.com/dotnet/coreclr/blob/cb9cbef5cd036bb761720...
- benaadams 10y agobitscan would change 3 instructions (xor, mul, -1) with one - wouldn't be a huge difference; in this particular scenario.