From 2c3a501fc34ff519e0418b821f47d68b1becd216 Mon Sep 17 00:00:00 2001 From: Cliff Spradlin via Linuxptp-devel Date: Tue, 30 Oct 2018 12:26:46 -0700 Subject: [PATCH] Use llabs() instead of fabs() for integers. Change-Id: I64cf1d4e1728c31ced40aff865d66b5b4356560f Signed-off-by: Cliff Spradlin --- nullf.c | 4 ++-- pi.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nullf.c b/nullf.c index 5512837..9a40d07 100644 --- a/nullf.c +++ b/nullf.c @@ -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; diff --git a/pi.c b/pi.c index 35556e1..bfe5022 100644 --- a/pi.c +++ b/pi.c @@ -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;