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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top