X-Spam-Check-By: sourceware.org Date: Fri, 21 Apr 2006 15:02:56 +0200 To: cygwin AT cygwin DOT com Subject: Re: htonl, htons, ntohl and ntohs types Message-ID: <20060421130256.GB16326@tuxedo.skovlyporten.dk> References: <20060421092508 DOT GA15855 AT tuxedo DOT skovlyporten DOT dk> <20060421100000 DOT GC12661 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg" Content-Disposition: inline In-Reply-To: <20060421100000.GC12661@calimero.vinschen.de> User-Agent: Mutt/1.5.11+cvs20060403 From: lars AT segv DOT dk (Lars Munch) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 21, 2006 at 12:00:00PM +0200, Corinna Vinschen wrote: > On Apr 21 11:25, Lars Munch wrote: > > Hello > > > > I have noticed that the types of the functions htonl, htons, ntohs and > > ntohl differs from standard (and linux): > > > > http://www.opengroup.org/onlinepubs/000095399/functions/htonl.html > > > > Cygwin uses: > > > > unsigned long int ntohl(unsigned long int); > > unsigned short int ntohs(unsigned short int); > > unsigned long int htonl(unsigned long int); > > unsigned short int htons(unsigned short int); > > > > The standard (and Linux) has: > > > > uint32_t htonl(uint32_t hostlong); > > uint16_t htons(uint16_t hostshort); > > uint32_t ntohl(uint32_t netlong); > > uint16_t ntohs(uint16_t netshort); > > > > Is there any reason for this difference? > > Nobody had a problem so far? > > Fixed in CVS. > You missed one. See attachment. -- Lars Munch --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="byteorder.patch" Index: ./winsup/cygwin/include/asm/byteorder.h =================================================================== RCS file: /cvs/src/src/winsup/cygwin/include/asm/byteorder.h,v retrieving revision 1.3 diff -u -r1.3 byteorder.h --- ./winsup/cygwin/include/asm/byteorder.h 21 Apr 2006 09:59:07 -0000 1.3 +++ ./winsup/cygwin/include/asm/byteorder.h 21 Apr 2006 13:00:03 -0000 @@ -36,7 +36,7 @@ extern __inline__ uint16_t __constant_ntohs(uint16_t); extern __inline__ uint32_t -__ntohl(unsigned long int x) +__ntohl(uint32_t x) { __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ "rorl $16,%0\n\t" /* swap words */ --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --gKMricLos+KVdGMg--