```c
STATIC mp_int_t getuwidth(mp_int_t cord) {
mp_int_t uw = 0;
switch (chrtype(cord)) {
case 0: uw = 1;
break;
case 1: uw = 1;
break;
case 2: uw = 2;
break;
case 3: uw = 2;
break;
case 4: uw = 2;
break;
}
return uw;
}
```
After being executed for 20+ time, it will cause LoadProhibited error.
```c
STATIC mp_int_t getuwidth(mp_int_t cord) {
if (chrtype((uint32_t)cord) <= 1) {
return 1;
} else {
return 2;
}
}
```
But this have no such problem, why?
curious about why an almost equivalent C code can avoid LoadProhibited error
Re: curious about why an almost equivalent C code can avoid LoadProhibited error
In most cases this is a sign of a buffer overflow or some screwup with an interrupt handler or a similar problem in the rest(!) of your code. Take a detailed look at the core dump.
If you change the source, even if it is equivalent, the resulting assembler code might be longer or shorter or quicker or slower. This can dig up or hide problems that were there all along (and not in the code you changed).
If you change the source, even if it is equivalent, the resulting assembler code might be longer or shorter or quicker or slower. This can dig up or hide problems that were there all along (and not in the code you changed).
ESP32 / ESP-IDF 5.1.4
Who is online
Users browsing this forum: No registered users and 95 guests