diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-02-26 15:37:18 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-02-26 16:46:34 +0000 |
commit | fda9a19b3465e3eb6ef74611a85021055eb78a64 (patch) | |
tree | be79c31f05f6d6dbdfe483c05d196d1d62435b8e | |
parent | 092010db3798f9a49ff9184bf238099af849e885 (diff) |
util: Add util_bswap16.
-rw-r--r-- | 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 b2969a210a..d1ec13def3 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. */ |