byteswap.h 886 B

12345678910111213141516171819202122232425262728293031323334
  1. /* File: libc/sysdeps/linux/bfin/bits/byteswap.h
  2. *
  3. * Copyright 2004-2006 Analog Devices Inc.
  4. *
  5. * Enter bugs at http://blackfin.uclinux.org/
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #ifndef _ASM_BITS_BYTESWAP_H
  10. #define _ASM_BITS_BYTESWAP_H 1
  11. #define __bswap_non_constant_16(x) \
  12. (__extension__ \
  13. ({ register unsigned short int __v; \
  14. __asm__ ("%0 = PACK (%1.L, %1.L);" \
  15. "%0 >>= 8;" \
  16. : "=d" (__v) \
  17. : "d" (x)); \
  18. __v; }))
  19. #define __bswap_non_constant_32(x) \
  20. (__extension__ \
  21. ({ register unsigned int __v; \
  22. __asm__ ("%1 = %0 >> 8 (V);" \
  23. "%0 = %0 << 8 (V);" \
  24. "%0 = %0 | %1;" \
  25. "%1 = PACK(%0.L, %0.H);" \
  26. : "+d"(x), "=&d"(__v)); \
  27. __v; }))
  28. #endif
  29. #include <bits/byteswap-common.h>