min / max c ode stdlib ?? Solved
Anubispod
Posts: 42
Hi, i have some code that i port where they use the min max functions from c. and they should be in stdlib. but some how i get the error
thats the code i trz to port
its a port from a Arduino code ??
Best regards
Oliver R
Edit :
have written some functions seems to work
thats the code i trz to port
tmp = min(abs(rcData[axis]-MIDRC),500);
C:\Users\R2D2\AppData\Local\Temp\ccFucLX0.o: In function `_annexCode': (.text+0x48): undefined reference to `_min' collect2: ld returned 1 exit status
its a port from a Arduino code ??
Best regards
Oliver R
Edit :
have written some functions seems to work
int32_t constrain(int32_t x, int32_t a, int32_t b) { if(x < a) { return a; } else if(b < x) { return b; } else return x; } int32_t min(int32_t a, int32_t b) { if(a < b) { return a; } else return b; } int32_t max(int32_t a, int32_t b) { if(a > b) { return a; } else return b; }
Comments
If you make your versions macros, or better yet inline functions, they can be expanded inline to the appropriate Propeller instructions.
Eric
If you make your versions macros, or better yet inline functions, they can be expanded inline to the appropriate Propeller instructions.
Eric