From owner-svn-src-all@FreeBSD.ORG Sun Jul 6 16:20:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CD8695E; Sun, 6 Jul 2014 16:20:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29A4D2F07; Sun, 6 Jul 2014 16:20:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s66GKc5W081376; Sun, 6 Jul 2014 16:20:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s66GKce3081375; Sun, 6 Jul 2014 16:20:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201407061620.s66GKce3081375@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 6 Jul 2014 16:20:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268321 - head/sys/powerpc/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2014 16:20:38 -0000 Author: nwhitehorn Date: Sun Jul 6 16:20:37 2014 New Revision: 268321 URL: http://svnweb.freebsd.org/changeset/base/268321 Log: In case we ever support little-endian PowerPC (probably userland only), avoid hardcoding endianness here. Modified: head/sys/powerpc/include/endian.h Modified: head/sys/powerpc/include/endian.h ============================================================================== --- head/sys/powerpc/include/endian.h Sun Jul 6 16:19:55 2014 (r268320) +++ head/sys/powerpc/include/endian.h Sun Jul 6 16:20:37 2014 (r268321) @@ -39,8 +39,13 @@ /* * Define the order of 32-bit words in 64-bit words. */ +#ifdef __LITTLE_ENDIAN__ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 +#else #define _QUAD_HIGHWORD 0 #define _QUAD_LOWWORD 1 +#endif /* * GCC defines _BIG_ENDIAN and _LITTLE_ENDIAN equal to __BIG_ENDIAN__ @@ -131,9 +136,16 @@ __bswap64_var(__uint64_t _x) #define __bswap64(x) (__is_constant(x) ? __bswap64_const(x) : \ __bswap64_var(x)) +#ifdef __LITTLE_ENDIAN__ +#define __htonl(x) (__bswap32((__uint32_t)(x))) +#define __htons(x) (__bswap16((__uint16_t)(x))) +#define __ntohl(x) (__bswap32((__uint32_t)(x))) +#define __ntohs(x) (__bswap16((__uint16_t)(x))) +#else #define __htonl(x) ((__uint32_t)(x)) #define __htons(x) ((__uint16_t)(x)) #define __ntohl(x) ((__uint32_t)(x)) #define __ntohs(x) ((__uint16_t)(x)) +#endif #endif /* !_MACHINE_ENDIAN_H_ */