Add spa/utils/endian.h

This provides access to GNU C library-style endian and byteswap functions.

Windows doesn't provide pre-processor defines for endianness, but
all current Windows architectures (X32, X64, ARM) are little-endian.
This commit is contained in:
David Coles 2024-06-25 16:32:13 -07:00 committed by Wim Taymans
parent a97e8b6d1f
commit 5d7624001d
10 changed files with 35 additions and 30 deletions

View file

@ -3,16 +3,9 @@
/* SPDX-License-Identifier: MIT */
#include <math.h>
#if defined(__FreeBSD__) || defined(__MidnightBSD__)
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#else
#include <byteswap.h>
#endif
#include <spa/utils/defs.h>
#include <spa/utils/endian.h>
#include <spa/utils/string.h>
#define f32_round(a) lrintf(a)