From 53615f5643d273638ae6ee1e14fa6591e394a772 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Tue, 4 Apr 2023 09:27:12 +0000 Subject: [PATCH] coap_encode.c: Fix coap_flsll() for negative numbers --- src/coap_encode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coap_encode.c b/src/coap_encode.c index f32931db..4c07b1c6 100644 --- a/src/coap_encode.c +++ b/src/coap_encode.c @@ -23,8 +23,9 @@ int coap_fls(unsigned int i) { #endif #ifndef HAVE_FLSLL -int coap_flsll(long long i) +int coap_flsll(long long j) { + unsigned long long i = (unsigned long long)j; int n; for (n = 0; i; n++) i >>= 1;