This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

c dode for 24bit*8bit multiplication,result of 32bit should be divided by 32 bit

i want to multiply 24bit value which i get from spi ,i stored it in an array of 3byte & i want to multiply with a constant of 8bit,the result i get which is a 32bit has to be divided with a constant of 32bit
i want a c code for this procedure so pls help me

Parents Reply Children
  • "can i put k=e/s for that ..."

    Yes. The result of the '/' operator is the quotient from the division of the first operand by the second; the result of the '%' operator is the remainder.

  • mr.dan henry i am interested in knowing what the following code do

    do {

    w = e - s;

    if (w < 0)

    goto endit;

    s >>= 1; : :
    } while ((s & 0x80000000) == 0);
    : :
    endit:
    i didn't understand the procedure clearly how to divide 32bit/32bit pls send me algorithm

  • "i am interested in knowing what the following code do"

    It was only intended to illustrate my interpretation of what part of your assembly code was doing and how one might go about translating assembly to C. The ':' characters indicate that more follows but is left as an exercise for the reader (you) to complete.

    "how to divide 32bit/32bit "

    unsigned long dividend, divisor, quotient, remainder;
    
    quotient  = dividend / divisor;
    remainder = dividend % divisor;
    

    This is basic C stuff. You should try to get your hands on a C tutorial and/or reference book.