C++ --> Delphi?

Hi...please, can anyone help me?

I need to 'translate' this function to delphi:

unsigned char Testa32Bits(unsigned __int32 valor, unsigned char Bit)
{
    unsigned __int32 BitMask = 1; //00000000-00000000-00000000-00000001.
    ShowMessage(IntToStr(BitMask));
    BitMask = (unsigned __int32)BitMask << Bit; //desloca bits para a esquerda.
     ShowMessage(IntToStr(BitMask));
    if( (valor & BitMask) == BitMask ) //se bit ligado.
        return 1;
    else
       return 0;
}
JmaurinAsked:
Who is Participating?
 
david_barkerCommented:
function Testa32Bits(valor : longword; bit : byte) : byte;
var
  BitMask : longword;
begin
  BitMask:=1;
  ShowMessage(IntToStr(BitMask));
  BitMask:=BitMask shl Bit;
  ShowMessage(IntToStr(BitMask));
  if (valor and BitMask)=BitMask then Result:=1 else Result:=0;
end;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.