From e4819f6410da9f740845487fe51d5b88f586052f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 11 Jan 2025 15:49:39 +0100 Subject: [PATCH] Simplfy cmpack --- src/netcode/d_net.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index 4860d8688..ff68f5b8d 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -188,13 +188,9 @@ static node_t nodes[MAXNETNODES]; // 0 if a = n (mod 256) // >0 if a > b (mod 256) // mnemonic: to use it compare to 0: cmpack(a,b)<0 is "a < b" ... -FUNCMATH static INT32 cmpack(UINT8 a, UINT8 b) +FUNCMATH static inline INT32 cmpack(UINT8 a, UINT8 b) { - register INT32 d = a - b; - - if (d >= 127 || d < -128) - return -d; - return d; + return (SINT8)(a - b); } /** Sets freeack to a free acknum and copies the netbuffer in the ackpak table