MAKELONG equivalent in c#

Is there a way to combine to short values into one long value in C#, similar to the way that the C++ MAKELONG macro does?
[129 byte] By [Snickel65] at [2007-12-24]
# 1

Yes, using the same shift and bitwise or operations used in the C macro.

Here is a sample implementation:
publicint MakeLong (short lowPart, short highPart)
{
return
(int)(((ushort)lowPart) | (uint)(highPart << 16));
}

MichaelKoster at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
How would I break the returned int value into its two original short values?
Snickel65 at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 3

Try this:

publicint MakeLong (short lowPart,short highPart){
return (int)(((ushort)lowPart) | (uint)(highPart << 16));}
publicstaticshort HiWord(int dword){
return (short) (dword >> 16);}
 publicstaticshort LoWord(int dword)
{return (short) dword;
}
JamesCurran at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...