Use llabs() instead of fabs() for integers.

Change-Id: I64cf1d4e1728c31ced40aff865d66b5b4356560f
Signed-off-by: Cliff Spradlin <cspradlin@google.com>
master
Cliff Spradlin via Linuxptp-devel 2018-10-30 12:26:46 -07:00 committed by Richard Cochran
parent 80b1d25dfd
commit 2c3a501fc3
2 changed files with 5 additions and 5 deletions

View File

@ -44,8 +44,8 @@ static double nullf_sample(struct servo *servo, int64_t offset,
}
if ((servo->first_update && servo->first_step_threshold &&
servo->first_step_threshold < fabs(offset)) ||
(servo->step_threshold && servo->step_threshold < fabs(offset))) {
servo->first_step_threshold < llabs(offset)) ||
(servo->step_threshold && servo->step_threshold < llabs(offset))) {
*state = SERVO_JUMP;
} else {
*state = SERVO_UNLOCKED;

6
pi.c
View File

@ -112,9 +112,9 @@ static double pi_sample(struct servo *servo,
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 < llabs(offset)))
*state = SERVO_JUMP;
else
*state = SERVO_LOCKED;
@ -131,7 +131,7 @@ static double pi_sample(struct servo *servo,
* clock startup.
*/
if (servo->step_threshold &&
servo->step_threshold < fabs(offset)) {
servo->step_threshold < llabs(offset)) {
*state = SERVO_UNLOCKED;
s->count = 0;
break;