gnuradio/trunk/usrp/host/lib/legacy/usrp_bytesex.h includes byteswap.h,
which appears to be a Linux-specific header file. I looked briefly, and
didn’t see any POSIX/SUSv3 definitions of these macros. I just fixed
this to build on NetBSD, which I suspect also fixes it on several other
NetBSD has bswap macros, in machine/bswap.h:
BSWAP(3) NetBSD Library Functions Manual
bswap16, bswap32, bswap64 – byte-order swapping functions
Standard C Library (libc, -lc)
uint16_t bswap16(uint16_t); uint32_t bswap32(uint32_t); uint64_t bswap64(uint64_t);
The bswap16(), bswap32(), and bswap64() functions return the value
their argument with the bytes inverted. They can be used to
32 or 64 bits integers from little to big endian, or vice-versa.
NetBSD 4.0_BETA2 March 17, 1998 NetBSD
Berndt sent a patch to the list to look for this; it seems equally
reasonable as the Linux header, neither being defined by a standard.
Also, the code uses ‘short int’ and ‘int’, which is nonportable. It
should be using the POSIX fixed-width types.
I wonder if the use of swap is really right - this seems to be about
host to USRP, but perhaps the USRP is always little endian? It
definitely needs more comments if that’s what’s going on.