Commit 6f01c24f authored by Anup Patel's avatar Anup Patel Committed by Paul Walmsley
Browse files

byteorder: Add memcpy_to_le32() and memcpy_from_le32()

parent ba879dfc
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -173,6 +173,22 @@ static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
	}
}

static inline void memcpy_from_le32(u32 *dst, const __le32 *src, size_t words)
{
	size_t i;

	for (i = 0; i < words; i++)
		dst[i] = le32_to_cpu(src[i]);
}

static inline void memcpy_to_le32(__le32 *dst, const u32 *src, size_t words)
{
	size_t i;

	for (i = 0; i < words; i++)
		dst[i] = cpu_to_le32(src[i]);
}

static inline void be16_add_cpu(__be16 *var, u16 val)
{
	*var = cpu_to_be16(be16_to_cpu(*var) + val);