11.4Smartin/*  $NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin 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.4Smartin__RCSID("$NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin 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.3Sjoergbswap16(uint16_t x)
201.1Schristos{
211.4Smartin	/*LINTED*/
221.1Schristos	return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff);
231.1Schristos}
24