Using pragma intrinsic(sqrt, pow) in C#?
C++ Summary
Using the #prag开发者_StackOverflow社区ma intrinsic
command in the preprocessor section of your code will greatly increase the speed of most math function calls.
#pragma intrinsic(sqrt, pow)
The above code allows most math functions calls to be sent directly to the math co-processor rather than being sent to the function stack.
Question
Is there any way to do this in C#? Other than rewriting the built in functions to do something similar. Like for example, it is common to do power of two, so this would be appropriate, but it is not what I am looking for:
public double Pow2(double value)
{
return (value * value);
}
C# shouldn't need "#pragma intrinsic", because:
Accessing math coprocessor from C#
The JIT compiler knows about the math coprocessor and will use it.
精彩评论