Board index » delphi » Translate C Macro

Translate C Macro

I need a Delphi translation of this C Macro:

#define MAKELANGID (p, s) ((((WORD) (s)) << 10 | (WORD) (p))

 

Re:Translate C Macro


I got this:

 ((s shl 10) or p)

where s and p are Word. Is this correct?

On Wed, 14 May 1997 17:11:35 GMT, chri...@workmail.com (Chris Morris)
wrote:

Quote
>I need a Delphi translation of this C Macro:

>#define MAKELANGID (p, s) ((((WORD) (s)) << 10 | (WORD) (p))

Re:Translate C Macro


In article <3379f206.12747...@news.nbn.com>,
   chri...@workmail.com (Chris Morris) wrote:

Quote
>I need a Delphi translation of this C Macro:
>#define MAKELANGID (p, s) ((((WORD) (s)) << 10 | (WORD) (p))

I think that would be...

function MakeLangID(P, S: Word): Integer;
begin
  Result := (S shl 10) or p;
end;
            ^        ^
{ Brackets probably optional :) }

It's times like this that just really make me miss macroes <giggle>

  --=- Ritchie Annand

Other Threads