Spliting u16, u32 to u8 array

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

 



Hi,
I am sure at least some of you were faced to split a u16 or u32 value
in u8 array without being affected by host endianness. My search
turned empty for a standardized function for this task, but this seems
quite improbable. My task is to send 16 bit LE data through i2c.

I am looking for something like:
static void u16_to_u8_array(u16 value, u8 *array)
{
        *array = cpu_to_le16(value) >> 8;
        *(++array) = (u8) cpu_to_le16(value);
}

Best regards,
Crt
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux