Skip to main content
colin239955_st
Associate III
Jul 30, 2011 12:39 AM UTC
Question

u32 =u16*u16

Posted on July 30, 2011 at 02:39

Never used the Cosmic complier before do I require any header like math.h to do a u16*u16 into u32 doesn't seem to do anything.

    This topic has been closed for replies.

    2 replies

    luca239955_stm1_st
    Associate
    Jul 30, 2011 6:05 AM UTC
    Posted on July 30, 2011 at 08:05

    Hi,

    I'm not sure what you mean by ''doesn't seem to do anything'', but, if you want to calculate

    u32 =u16*u16

    in optimized form, you must write something like

    volatile unsigned short us1, us2, us3;

    volatile unsigned long ul;

    ul = (long) us1 * us2;

    Regards,

    Luca (Cosmic)

    colin239955_st
    Associate III
    Aug 2, 2011 5:17 PM UTC
    Posted on August 02, 2011 at 19:17

    I was missing the (long) never used this format before.

    Thanks