Skip to content

Commit 3fa6208

Browse files
committed
Add FreeBSD 13+ byteswap.h (TODO)
1 parent 61bf85e commit 3fa6208

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/Common/Common/ByteSwap.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ RtlUlonglongByteSwap(
6868
#define RtlUlongByteSwap(_x) __bswap_32((_x))
6969
#define RtlUlonglongByteSwap(_x) __bswap_64((_x))
7070

71+
#elif defined(__FreeBSD__)
72+
#include <byteswap.h>
73+
/* FreeBSD 13+, also above definitions would work
74+
* TODO replace with "has byteswap.h" check? */
75+
#define RtlUshortByteSwap(_x) bswap_16((_x))
76+
#define RtlUlongByteSwap(_x) bswap_32((_x))
77+
#define RtlUlonglongByteSwap(_x) bswap_64((_x))
78+
7179
#else
72-
// TODO: include endian.h for BSD?
7380
#error "ByteSwap.h: Not implemented for this platform"
7481
#endif

0 commit comments

Comments
 (0)