bswap16.c revision 1.2
11.2Sapb/* $NetBSD: bswap16.c,v 1.2 2008/02/16 17:37:13 apb Exp $ */ 21.1Schristos 31.1Schristos/* 41.1Schristos * Written by Manuel Bouyer <bouyer@NetBSD.org>. 51.1Schristos * Public domain. 61.1Schristos */ 71.1Schristos 81.1Schristos#include <sys/cdefs.h> 91.1Schristos#if defined(LIBC_SCCS) && !defined(lint) 101.2Sapb__RCSID("$NetBSD: bswap16.c,v 1.2 2008/02/16 17:37:13 apb Exp $"); 111.1Schristos#endif /* LIBC_SCCS and not lint */ 121.1Schristos 131.1Schristos#include <sys/types.h> 141.1Schristos#include <machine/bswap.h> 151.1Schristos 161.1Schristos#undef bswap16 171.1Schristos 181.2Sapbuint16_t 191.1Schristosbswap16(x) 201.2Sapb uint16_t x; 211.1Schristos{ 221.1Schristos return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); 231.1Schristos} 24