swab.h 911 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * vineetg: May 2011
  10. * -Support single cycle endian-swap insn in ARC700 4.10
  11. *
  12. * vineetg: June 2009
  13. * -Better htonl implementation (5 instead of 9 ALU instructions)
  14. * -Hardware assisted single cycle bswap (Use Case of ARC custom instrn)
  15. */
  16. #ifndef __ASM_ARC_SWAB_H
  17. #define __ASM_ARC_SWAB_H
  18. #include <linux/types.h>
  19. #define __arch_swab32(x) \
  20. ({ \
  21. unsigned int tmp = x; \
  22. __asm__( \
  23. " swape %0, %1 \n" \
  24. : "=r" (tmp) \
  25. : "r" (tmp)); \
  26. tmp; \
  27. })
  28. #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
  29. #define __SWAB_64_THRU_32__
  30. #endif
  31. #endif