Skip to main content
Visitor II
July 30, 2011
Question

u32 =u16*u16

  • July 30, 2011
  • 2 replies
  • 676 views
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

    Visitor II
    July 30, 2011
    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)

    Visitor II
    August 2, 2011
    Posted on August 02, 2011 at 19:17

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

    Thanks