Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
January 8, 2013 - 8:45am
|
How to force STM8 compiler to use optimal unsigned 16 x 16 ? 32 multiplication (?C?MULU161632) uint32_t multRez; #define SPEED multRez = (uint32_t)43678 * var; #undefine SPEED *** WARNING P005 IN LINE 814 OF src\functions.c : Control 'undefine' unknown I can not use SPEED optimization for whole code just, but how do I instruct compiler to use SPEED optimization just for portion? |
Hi,
For the SPEED optimization you can do as follow:
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
uint32_t multRez;
uint16_t var;
#pragma ot(7,SPEED)
void main( void )
{
multRez = (uint32_t)43678 * var;
}
#pragma ot(7,SIZE)
Warning:
If you do two optimisation in the main function (SPEED optimising and a SIZE optimising in the same function) you will get the same result as before (?C?MULU161632).
Regards,
Etienne