I am wondering how exactly CDQ would work in C#. Anyone know a C# equivalent?
Printable View
I am wondering how exactly CDQ would work in C#. Anyone know a C# equivalent?
What does a processor instruction have to do with a high-level language like C#?
Something like this...
In fact since C# is so much higher-level than ASM, the above would be virtually identical to the implementation of the MOVSE (move with sign extend) opcode.Code:ulong CDQ(uint d)
{
if((d & 0x80000000) != 0)
return 0xffffffff00000000 | (ulong)d; //sign extend 1
else
return (ulong)d; //sign extend 0 (this is implicit)
}