util: Add util_bswap16.

This commit is contained in:
José Fonseca 2010-02-26 15:37:18 +00:00
parent 092010db37
commit fda9a19b34
1 changed files with 11 additions and 0 deletions

View File

@ -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.