C++ --> Delphi?

Posted on 2005-04-23
Last Modified: 2008-01-09
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.
    BitMask = (unsigned __int32)BitMask << Bit; //desloca bits para a esquerda.
    if( (valor & BitMask) == BitMask ) //se bit ligado.
        return 1;
       return 0;
Question by:Jmaurin
    1 Comment
    LVL 6

    Accepted Solution

    function Testa32Bits(valor : longword; bit : byte) : byte;
      BitMask : longword;
      BitMask:=BitMask shl Bit;
      if (valor and BitMask)=BitMask then Result:=1 else Result:=0;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    How to I add a folder to an existing GIT repository? 7 76
    while loop over for loop 7 65
    sum13 challenge 24 68
    no14 challenge 14 46
    There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
    This article will show, step by step, how to integrate R code into a R Sweave document
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now