mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-11 11:20:40 +03:00
test_session.c: fix warning for taken absolute value of unsigned int
This change replaces the call of abs(v - ref) to avoid a compiler
warning for -Wabsolute-value:
test_session.c:95:11: warning: taking the absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
return (abs(v - ref) / 100.0) <= FP_ERR_THRESHOLD;
This commit is contained in:
1 parent
90cd1ac193
commit
56caa06677
1 file changed
+2
-1
@@ -92,7 +92,8 @@ timeout(const coap_fixed_point_t ack_timeout,
|
||||
*/
|
||||
COAP_STATIC_INLINE int
|
||||
good_enough(unsigned int v, unsigned int ref) {
|
||||
return (abs(v - ref) / 100.0) <= FP_ERR_THRESHOLD;
|
||||
#define delta(a,b) (((a) < (b)) ? ((b) - (a)) : ((a) - (b)))
|
||||
return (delta(v,ref) / 100.0) <= FP_ERR_THRESHOLD;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in new issue
Block a user