Mesa (master): util: Add util_bswap16.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Feb 26 16:47:28 UTC 2010


Module: Mesa
Branch: master
Commit: fda9a19b3465e3eb6ef74611a85021055eb78a64
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fda9a19b3465e3eb6ef74611a85021055eb78a64

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Feb 26 15:37:18 2010 +0000

util: Add util_bswap16.

---

 src/gallium/auxiliary/util/u_math.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index b2969a2..d1ec13d 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -532,6 +532,17 @@ util_bswap32(uint32_t n)
 
 
 /**
+ * Reverse byte order of a 16 bit word.
+ */
+static INLINE uint16_t
+util_bswap16(uint16_t n)
+{
+   return (n >> 8) |
+          (n << 8);
+}
+
+
+/**
  * Clamp X to [MIN, MAX].
  * This is a macro to allow float, int, uint, etc. types.
  */




More information about the mesa-commit mailing list