cancel
Showing results for 
Search instead for 
Did you mean: 

u32 =u16*u16

colin239955_st
Associate II
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.

2 REPLIES 2
luca239955_stm1_st
Senior II
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 II
Posted on August 02, 2011 at 19:17

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

Thanks