Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

byteorder: Add le64_to_cpu_array() and cpu_to_le64_array()

Add le64_to_cpu_array() and cpu_to_le64_array(). These mirror the
corresponding 32-bit functions.

These will be used by the BLAKE2b code.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20251018043106.375964-6-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+16
+16
include/linux/byteorder/generic.h
··· 173 173 } 174 174 } 175 175 176 + static inline void le64_to_cpu_array(u64 *buf, unsigned int words) 177 + { 178 + while (words--) { 179 + __le64_to_cpus(buf); 180 + buf++; 181 + } 182 + } 183 + 184 + static inline void cpu_to_le64_array(u64 *buf, unsigned int words) 185 + { 186 + while (words--) { 187 + __cpu_to_le64s(buf); 188 + buf++; 189 + } 190 + } 191 + 176 192 static inline void memcpy_from_le32(u32 *dst, const __le32 *src, size_t words) 177 193 { 178 194 size_t i;