P
pozz
I have the following code:
---
#define HZ 1000
unsigned int calc(unsigned int x) {
x = x * HZ / 1000;
}
void main(void) {
unsigned int y = calc(23);
...
}
---
When I compile it with a compiler for a 16-bit embedded
microcontroller, I see the code for multiplication and division in
calc function. The optimization is on.
Is there any method to avoid the time consuming multiplication and
division?
---
#define HZ 1000
unsigned int calc(unsigned int x) {
x = x * HZ / 1000;
}
void main(void) {
unsigned int y = calc(23);
...
}
---
When I compile it with a compiler for a 16-bit embedded
microcontroller, I see the code for multiplication and division in
calc function. The optimization is on.
Is there any method to avoid the time consuming multiplication and
division?