From: José Fonseca Date: Fri, 26 Feb 2010 15:37:18 +0000 (+0000) Subject: util: Add util_bswap16. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fda9a19b3465e3eb6ef74611a85021055eb78a64;p=mesa.git util: Add util_bswap16. --- diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index b2969a210a7..d1ec13def30 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -531,6 +531,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.