On Mon, Apr 15, 2024 at 2:32 PM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab(a)nec.com>
wrote:
Sure. The macro '#if __BYTE_ORDER == __BIG_ENDIAN' takes effect on a
big-endian machine. But it requires to include the header file 'byteswap.h'
as below:
#include <byteswap.h>
In addition, there is a similar implementation, but I haven't tested it
with Yulong's case. Can you help to check if this can work well for you?
Yulong.
static inline uint16_t
get_unaligned_le16 (const uint8_t *p)
{
return p[0] | p[1] << 8;
}
Hi, Lianbo
It works well in my case(little-endian). This looks promising, but I don't have a
big-endian machine to test it on.
Thanks,
Yulong
>
> Thank
> Lianbo