Address Oliver's comments

This commit is contained in:
Colin Leroy-Mira 2023-09-07 16:48:56 +02:00
parent dfe7562f76
commit a90aa57510
4 changed files with 34 additions and 8 deletions

View File

@ -4403,7 +4403,7 @@ to undefined behaviour.
<quote>
<descrip>
<tag/Function/Swaps byte order in a 32 bit word.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
<tag/Declaration/<tt/int htonl(val)/
<tag/Description/Converts a 32 bit word from from network byte order
(big endian) to little endian (or vice-versa).
@ -4423,7 +4423,7 @@ be used in presence of a prototype.
<quote>
<descrip>
<tag/Function/Swaps byte order in a 16 bit word.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
<tag/Declaration/<tt/int htons(val)/
<tag/Description/Converts a 16 bit word from from network byte order
(big endian) to little endian (or vice-versa) by swapping both its bytes.
@ -5811,7 +5811,7 @@ memory allocated for the driver.
<quote>
<descrip>
<tag/Function/Swaps byte order in a 32 bit word.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
<tag/Declaration/<tt/int __fastcall__ ntohl (int val);/
<tag/Description/Converts a 32 bit word from from host byte order (little endian)
to big endian (or vice-versa).
@ -5830,7 +5830,7 @@ be used in presence of a prototype.
<quote>
<descrip>
<tag/Function/Swaps byte order in a 16 bit word.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Header/<tt/<ref id="inet.h" name="arpa/inet.h">/
<tag/Declaration/<tt/int __fastcall__ ntohs (int val);/
<tag/Description/Converts a 16 bit word from from host byte order (little endian)
to big endian (or vice-versa) by swapping both its bytes.

View File

@ -1,3 +1,33 @@
/*****************************************************************************/
/* */
/* arpa/inet.h */
/* */
/* Endianness utilities for cc65 */
/* */
/* */
/* */
/* (C) 2023 Colin Leroy-Mira, <colin@colino.net> */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _ARPA_INET_H
#define _ARPA_INET_H

View File

@ -9,13 +9,11 @@
.importzp tmp1, tmp2, sreg
_htonl := _ntohl
.code
_ntohl:
; The parts of our 32 bit word
; are in sreg+1, sreg, X, A.
; Save A and X
stx tmp1
sta tmp2

View File

@ -9,8 +9,6 @@
_htons := _ntohs
.code
_ntohs:
sta tmp1
txa