From cbc5603d631cff1f1ba8aaa78909c56bbd1387f9 Mon Sep 17 00:00:00 2001 From: Colin Leroy-Mira Date: Thu, 7 Sep 2023 21:00:30 +0200 Subject: [PATCH] Inline ntohs/htons as a macro if -i is passed --- include/arpa/inet.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/arpa/inet.h b/include/arpa/inet.h index e1e970e07..2fb47388d 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -31,8 +31,22 @@ #ifndef _ARPA_INET_H #define _ARPA_INET_H +#ifndef __OPT_i__ int __fastcall__ ntohs (int val); int __fastcall__ htons (int val); +#else + +#define ntohs(x) \ + ( \ + __AX__=(x), \ + asm("sta tmp1"), \ + asm("txa"), \ + asm("ldx tmp1"), \ + __AX__ \ + ) +#define htons(x) ntohs(x) + +#endif long __fastcall__ ntohl (long val); long __fastcall__ htonl (long val);