swab.h 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_SWAB_H
  3. #define _LINUX_SWAB_H
  4. #include <uapi/linux/swab.h>
  5. # define swab16 __swab16
  6. # define swab32 __swab32
  7. # define swab64 __swab64
  8. # define swab __swab
  9. # define swahw32 __swahw32
  10. # define swahb32 __swahb32
  11. # define swab16p __swab16p
  12. # define swab32p __swab32p
  13. # define swab64p __swab64p
  14. # define swahw32p __swahw32p
  15. # define swahb32p __swahb32p
  16. # define swab16s __swab16s
  17. # define swab32s __swab32s
  18. # define swab64s __swab64s
  19. # define swahw32s __swahw32s
  20. # define swahb32s __swahb32s
  21. static inline void swab16_array(u16 *buf, unsigned int words)
  22. {
  23. while (words--) {
  24. swab16s(buf);
  25. buf++;
  26. }
  27. }
  28. static inline void swab32_array(u32 *buf, unsigned int words)
  29. {
  30. while (words--) {
  31. swab32s(buf);
  32. buf++;
  33. }
  34. }
  35. static inline void swab64_array(u64 *buf, unsigned int words)
  36. {
  37. while (words--) {
  38. swab64s(buf);
  39. buf++;
  40. }
  41. }
  42. #endif /* _LINUX_SWAB_H */