Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Aug 2010 22:35:20 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r211320 - projects/ofed/head/sys/amd64/include
Message-ID:  <201008142235.o7EMZKv0040867@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Sat Aug 14 22:35:20 2010
New Revision: 211320
URL: http://svn.freebsd.org/changeset/base/211320

Log:
   - One more endian bug; cast the results of byte_swap_*_const() to the
     expected result type.  Sometimes wider types are passed in but should
     not be produced.

Modified:
  projects/ofed/head/sys/amd64/include/endian.h

Modified: projects/ofed/head/sys/amd64/include/endian.h
==============================================================================
--- projects/ofed/head/sys/amd64/include/endian.h	Sat Aug 14 22:28:07 2010	(r211319)
+++ projects/ofed/head/sys/amd64/include/endian.h	Sat Aug 14 22:35:20 2010	(r211320)
@@ -83,7 +83,7 @@ __byte_swap_int_var(__uint32_t x)
 #ifdef __OPTIMIZE__
 
 #define	__byte_swap_int_const(x) \
-	((((x) & 0xff000000) >> 24) | \
+	(__uint32_t)((((x) & 0xff000000) >> 24) | \
 	 (((x) & 0x00ff0000) >>  8) | \
 	 (((x) & 0x0000ff00) <<  8) | \
 	 (((x) & 0x000000ff) << 24))
@@ -109,7 +109,7 @@ __byte_swap_long_var(__uint64_t x)
 #ifdef __OPTIMIZE__
 
 #define	__byte_swap_long_const(x) \
-	((__uint64_t)(((__uint64_t)x >> 56) |		\
+	(__uint64_t)((((__uint64_t)x >> 56) |		\
 	 (((__uint64_t)x >> 40) & 0xff00) |		\
 	 (((__uint64_t)x >> 24) & 0xff0000) |		\
 	 (((__uint64_t)x >> 8) & 0xff000000) |		\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008142235.o7EMZKv0040867>