Date: Tue, 27 May 2008 03:34:14 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 142348 for review Message-ID: <200805270334.m4R3YE4j029584@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142348 Change 142348 by jb@freebsd3 on 2008/05/27 03:33:43 Do byte order tests the FreeBSD way. Affected files ... .. //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c#3 edit Differences ... ==== //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c#3 (text+ko) ==== @@ -54,11 +54,13 @@ #pragma weak xdr_int64_t = xdr_longlong_t #pragma weak xdr_uint64_t = xdr_u_longlong_t +#if defined(sun) #if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) #error "Exactly one of _BIG_ENDIAN or _LITTLE_ENDIAN must be defined" #elif defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) #error "Only one of _BIG_ENDIAN or _LITTLE_ENDIAN may be defined" #endif +#endif /* * constants specific to the xdr "protocol" @@ -174,12 +176,12 @@ xdr_longlong_t(XDR *xdrs, longlong_t *hp) { if (xdrs->x_op == XDR_ENCODE) { -#if defined(_LITTLE_ENDIAN) +#if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)hp)); } -#elif defined(_BIG_ENDIAN) +#else if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); @@ -189,12 +191,12 @@ } if (xdrs->x_op == XDR_DECODE) { -#if defined(_LITTLE_ENDIAN) +#if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)hp)); } -#elif defined(_BIG_ENDIAN) +#else if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); @@ -213,12 +215,12 @@ { if (xdrs->x_op == XDR_ENCODE) { -#if defined(_LITTLE_ENDIAN) +#if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)hp)); } -#elif defined(_BIG_ENDIAN) +#else if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); @@ -228,12 +230,12 @@ } if (xdrs->x_op == XDR_DECODE) { -#if defined(_LITTLE_ENDIAN) +#if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)hp)); } -#elif defined(_BIG_ENDIAN) +#else if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805270334.m4R3YE4j029584>