Steven Johnson wrote: >penguinfly wrote: > > > >>Hi,Steven Johnson: >>//// >>I changed the type of varc to uint32_t, but it is also doing wrong. >>did you test it ? >> >> > >No, I didnt. > >Try typecasting varb, like this: >varc = (unit32_t)(varb) * vara / 0x7000; > >If you only have 16 bit types, the result can only be 16 bits. (which is >what you had before). If GCC isnt working out it needs 32bit precision, >force it by type casting. > >Steven > > It isn't a matter of GCC working it out. GCC must follow the C99 spec, so its not allowed to work it out. The C99 spec is brain dead. However, doing the sane thing would make the compiler non-compliant.
Regards, Steve