2012-11-15 12:06:41 +01:00
|
|
|
/* $NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin Exp $ */
|
2011-02-14 20:36:03 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Written by Manuel Bouyer <bouyer@NetBSD.org>.
|
|
|
|
* Public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
2012-11-15 12:06:41 +01:00
|
|
|
__RCSID("$NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin Exp $");
|
2011-02-14 20:36:03 +01:00
|
|
|
#endif /* LIBC_SCCS and not lint */
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <machine/bswap.h>
|
|
|
|
|
|
|
|
#undef bswap16
|
|
|
|
|
|
|
|
uint16_t
|
2012-11-15 12:06:41 +01:00
|
|
|
bswap16(uint16_t x)
|
2011-02-14 20:36:03 +01:00
|
|
|
{
|
2012-11-15 12:06:41 +01:00
|
|
|
/*LINTED*/
|
2011-02-14 20:36:03 +01:00
|
|
|
return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
|
|
|
|
}
|