1
0
mirror of https://github.com/cc65/cc65.git synced 2026-04-21 09:17:52 +00:00

Merge pull request #2696 from colinleroy/optimize-ntohs-on-c02

Use new CPU macro to optimize ntohs on 65c02
This commit is contained in:
Bob Andrews
2025-06-12 19:51:11 +02:00
committed by GitHub
+17 -3
View File
@@ -40,6 +40,20 @@
/*****************************************************************************/
#if (__CPU__ & __CPU_ISET_65SC02__)
/* Always inline, three bytes is not more than a jsr */
#define ntohs(x) \
( \
__AX__=(x), \
asm("phx"), \
asm("tax"), \
asm("pla"), \
__AX__ \
)
#define htons(x) ntohs(x)
#else
#if (__OPT_i__ < 200)
int __fastcall__ ntohs (int val);
@@ -56,12 +70,12 @@ int __fastcall__ htons (int val);
)
#define htons(x) ntohs(x)
#endif
#endif /* __OPT_i__ < 200 */
#endif /* __CPU__ & __CPU_ISET_65SC02__ */
long __fastcall__ ntohl (long val);
long __fastcall__ htonl (long val);
/* End of arpa/inet.h */
#endif