1999-01-15 16:31:15 +03:00
|
|
|
/* $NetBSD: bswap16.c,v 1.2 1999/01/15 13:31:28 bouyer Exp $ */
|
1997-10-09 19:42:19 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Written by Manuel Bouyer <bouyer@netbsd.org>.
|
|
|
|
* Public domain.
|
|
|
|
*/
|
|
|
|
|
1999-01-15 16:31:15 +03:00
|
|
|
#include <sys/cdefs.h>
|
1997-10-09 19:42:19 +04:00
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
1999-01-15 16:31:15 +03:00
|
|
|
__RCSID("$NetBSD: bswap16.c,v 1.2 1999/01/15 13:31:28 bouyer Exp $");
|
|
|
|
#endif /* LIBC_SCCS and not lint */
|
1997-10-09 19:42:19 +04:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
1999-01-15 16:31:15 +03:00
|
|
|
#include <machine/bswap.h>
|
1997-10-09 19:42:19 +04:00
|
|
|
|
|
|
|
#undef bswap16
|
|
|
|
|
|
|
|
u_int16_t
|
|
|
|
bswap16(x)
|
1999-01-15 16:31:15 +03:00
|
|
|
u_int16_t x;
|
1997-10-09 19:42:19 +04:00
|
|
|
{
|
|
|
|
return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
|
|
|
|
}
|