discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Re: libusb error on Mac OS X when building uhd driver


From: Josh Blum
Subject: [Discuss-gnuradio] Re: libusb error on Mac OS X when building uhd driver
Date: Sun, 05 Sep 2010 13:24:53 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]