Re: byteswap.h not found on 12 and 13

From: Juraj Lutter <>
Date: Fri, 24 Mar 2023 09:13:24 UTC

> On 24 Mar 2023, at 10:09, Warner Losh <> wrote:
> one last reply, if this is for a port, then byteswap.h can usually be implemented as
> #include <sys/endian.h>
> #define __bswap_16(x) __bswap16(x)
> #define __bswap_32(x) __bswap32(x)
> #define __bswap_64(x) __bswap64(x)
> #define bswap_16(x) __bswap16(x)
> #define bswap_32(x) __bswap32(x)
> #define bswap_64(x) __bswap64(x)
> in older versions of FreeBSD, but some tricky software will hate the bswap16 (no underscore) etc defines. You could likely put that into the port.

In releng/13 there is also infiniband/byteswap.h that does:

#include <sys/types.h>
#include <sys/endian.h>

#define bswap_16        bswap16
#define bswap_32        bswap32
#define bswap_64        bswap64


Juraj Lutter