logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

swab.h (764B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _ASM_X86_SWAB_H
  3. #define _ASM_X86_SWAB_H
  4. #include <linux/types.h>
  5. #ifdef __GNUC__
  6. static __inline__ __u32 __arch_swab32(__u32 val)
  7. {
  8. __asm__("bswapl %0" : "=r" (val) : "0" (val));
  9. return val;
  10. }
  11. #define __arch_swab32 __arch_swab32
  12. static __inline__ __u64 __arch_swab64(__u64 val)
  13. {
  14. #ifdef __i386__
  15. union {
  16. struct {
  17. __u32 a;
  18. __u32 b;
  19. } s;
  20. __u64 u;
  21. } v;
  22. v.u = val;
  23. __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
  24. : "=r" (v.s.a), "=r" (v.s.b)
  25. : "0" (v.s.a), "1" (v.s.b));
  26. return v.u;
  27. #else /* __i386__ */
  28. __asm__("bswapq %0" : "=r" (val) : "0" (val));
  29. return val;
  30. #endif
  31. }
  32. #define __arch_swab64 __arch_swab64
  33. #endif /* __GNUC__ */
  34. #endif /* _ASM_X86_SWAB_H */