Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 840
  • Last Modified:

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;
}
0
Jmaurin
Asked:
Jmaurin
1 Solution
 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now