On 09/05/2010 04:11 AM, Elvis Dowson wrote:
Hi,
More specifically, there is a problem with calls to
libusb_cpu_to_le16(x) in libusb.h
/** \def libusb_cpu_to_le16
* \ingroup misc
* Convert a 16-bit value from host-endian to little-endian format. On
* little endian systems, this function does nothing. On big endian systems,
* the bytes are swapped.
* \param x the host-endian value to convert
* \returns the value in little-endian byte order
*/
#define libusb_cpu_to_le16(x) ({ \
union { \
uint8_t b8[2]; \
uint16_t b16; \
} _tmp; \
uint16_t _tmp2 = (uint16_t)(x); \
_tmp.b8[1] = _tmp2>> 8; \
_tmp.b8[0] = _tmp2& 0xff; \
_tmp.b16; \
})
That seems horrendous, is that even valid c code? Its better defined as
a function, or maybe a preprocessor conditional byteswap... Is it fixed
in the libusb10 repo at least?
-Josh
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio