Use llabs() instead of fabs() for integers.
Change-Id: I64cf1d4e1728c31ced40aff865d66b5b4356560f Signed-off-by: Cliff Spradlin <cspradlin@google.com>
This commit is contained in:
parent
80b1d25dfd
commit
2c3a501fc3
4
nullf.c
4
nullf.c
@ -44,8 +44,8 @@ static double nullf_sample(struct servo *servo, int64_t offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((servo->first_update && servo->first_step_threshold &&
|
if ((servo->first_update && servo->first_step_threshold &&
|
||||||
servo->first_step_threshold < fabs(offset)) ||
|
servo->first_step_threshold < llabs(offset)) ||
|
||||||
(servo->step_threshold && servo->step_threshold < fabs(offset))) {
|
(servo->step_threshold && servo->step_threshold < llabs(offset))) {
|
||||||
*state = SERVO_JUMP;
|
*state = SERVO_JUMP;
|
||||||
} else {
|
} else {
|
||||||
*state = SERVO_UNLOCKED;
|
*state = SERVO_UNLOCKED;
|
||||||
|
6
pi.c
6
pi.c
@ -112,9 +112,9 @@ static double pi_sample(struct servo *servo,
|
|||||||
|
|
||||||
if ((servo->first_update &&
|
if ((servo->first_update &&
|
||||||
servo->first_step_threshold &&
|
servo->first_step_threshold &&
|
||||||
servo->first_step_threshold < fabs(offset)) ||
|
servo->first_step_threshold < llabs(offset)) ||
|
||||||
(servo->step_threshold &&
|
(servo->step_threshold &&
|
||||||
servo->step_threshold < fabs(offset)))
|
servo->step_threshold < llabs(offset)))
|
||||||
*state = SERVO_JUMP;
|
*state = SERVO_JUMP;
|
||||||
else
|
else
|
||||||
*state = SERVO_LOCKED;
|
*state = SERVO_LOCKED;
|
||||||
@ -131,7 +131,7 @@ static double pi_sample(struct servo *servo,
|
|||||||
* clock startup.
|
* clock startup.
|
||||||
*/
|
*/
|
||||||
if (servo->step_threshold &&
|
if (servo->step_threshold &&
|
||||||
servo->step_threshold < fabs(offset)) {
|
servo->step_threshold < llabs(offset)) {
|
||||||
*state = SERVO_UNLOCKED;
|
*state = SERVO_UNLOCKED;
|
||||||
s->count = 0;
|
s->count = 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user