From 63b69d8d85c3cbc0f81d09d30856089f8ef91f1e Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 24 Dec 2023 09:36:41 +0000 Subject: [PATCH] util: fix absdiff64() always over/underflowing --- include/socks/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/socks/util.h b/include/socks/util.h index 3a0e268..ee5080d 100644 --- a/include/socks/util.h +++ b/include/socks/util.h @@ -23,7 +23,7 @@ static inline unsigned long long div64_pow2(unsigned long long x, unsigned long static inline unsigned long long absdiff64(unsigned long long x, unsigned long long y) { - return x > y ? y - x : x - y; + return x < y ? y - x : x - y; } extern int16_t host_to_big_i16(int16_t v);