xref: /third_party/alsa-lib/include/bswap.h (revision d5ac70f0)
1/*
2 *  ALSA lib - compatibility header for providing byte swapping macros
3 *  Copyright (c) 2016 by  Thomas Klausner <wiz@NetBSD.org>
4 *
5 *
6 *   This library is free software; you can redistribute it and/or modify
7 *   it under the terms of the GNU Lesser General Public License as
8 *   published by the Free Software Foundation; either version 2.1 of
9 *   the License, or (at your option) any later version.
10 *
11 *   This program is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 *   GNU Lesser General Public License for more details.
15 *
16 *   You should have received a copy of the GNU Lesser General Public
17 *   License along with this library; if not, write to the Free Software
18 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 *
20 */
21
22#ifndef __BSWAP_H
23#define __BSWAP_H
24
25#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
26#include <sys/endian.h>
27#define bswap_16 bswap16
28#define bswap_32 bswap32
29#define bswap_64 bswap64
30#elif defined(__OpenBSD__)
31#include <sys/endian.h>
32#define bswap_16 swap16
33#define bswap_32 swap32
34#define bswap_64 swap64
35#elif defined (__sun)
36#include <sys/byteorder.h>
37#define bswap_16 BSWAP_16
38#define bswap_32 BSWAP_32
39#define bswap_64 BSWAP_64
40#else
41#include <byteswap.h>
42#endif
43
44#endif
45