how can I implement MAKELONG in .NET

  • Thread starter Thread starter Franz
  • Start date Start date
Greets,

If you are referring to the MAKELONG() macro in windef.h, it basically
takes two parameters and puts the second parameter in the higher order word.
Since the 'int' is the same size in bits as the 'long' in Win32, the
following C# example should duplicate what the macro does (without
generating inline code):

public static int MakeLong(int a, int b)
{

return (int)((uint)((ushort)(a)) | ((uint)((ushort)(b) << 16)));

}


Regards,

Joe
 
Joe Delekto said:
Greets,

If you are referring to the MAKELONG() macro in windef.h, it basically
takes two parameters and puts the second parameter in the higher order word.
Since the 'int' is the same size in bits as the 'long' in Win32, the
following C# example should duplicate what the macro does (without
generating inline code):

public static int MakeLong(int a, int b)
{

return (int)((uint)((ushort)(a)) | ((uint)((ushort)(b) << 16)));

}
Thanks.



Regards,

Joe
 
Back
Top