byteswap.h 975 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * libc/sysdeps/linux/v850/bits/byteswap.h -- Macros to swap the order
  3. * of bytes in integer values
  4. *
  5. * Copyright (C) 2001 NEC Corporation
  6. * Copyright (C) 2001 Miles Bader <miles@gnu.org>
  7. * Copyright (C) 1997,1998,2001 Free Software Foundation, Inc.
  8. *
  9. * This file is subject to the terms and conditions of the GNU Lesser
  10. * General Public License. See the file COPYING.LIB in the main
  11. * directory of this archive for more details.
  12. */
  13. #ifndef _ASM_BITS_BYTESWAP_H
  14. #define _ASM_BITS_BYTESWAP_H 1
  15. #define __bswap_non_constant_16(x) \
  16. (__extension__ \
  17. ({ unsigned long int __bswap_16_v; \
  18. __asm__ ("bsh %1, %0" : "=r" (__bswap_16_v) : "r" (x)); \
  19. __bswap_16_v; }))
  20. # define __bswap_non_constant_32(x) \
  21. (__extension__ \
  22. ({ unsigned long int __bswap_32_v; \
  23. __asm__ ("bsw %1, %0" : "=r" (__bswap_32_v) : "r" (x)); \
  24. __bswap_32_v; }))
  25. #endif
  26. #include <bits/byteswap-common.h>