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

swab: Add array operations

For now, some simple array operations to swab.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220831212744.56435-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andy Shevchenko and committed by
Mark Brown
2d469737 6ed406ef

+25
+25
include/linux/swab.h
··· 20 20 # define swab64s __swab64s 21 21 # define swahw32s __swahw32s 22 22 # define swahb32s __swahb32s 23 + 24 + static inline void swab16_array(u16 *buf, unsigned int words) 25 + { 26 + while (words--) { 27 + swab16s(buf); 28 + buf++; 29 + } 30 + } 31 + 32 + static inline void swab32_array(u32 *buf, unsigned int words) 33 + { 34 + while (words--) { 35 + swab32s(buf); 36 + buf++; 37 + } 38 + } 39 + 40 + static inline void swab64_array(u64 *buf, unsigned int words) 41 + { 42 + while (words--) { 43 + swab64s(buf); 44 + buf++; 45 + } 46 + } 47 + 23 48 #endif /* _LINUX_SWAB_H */