1 /* Macros to swap the order of bytes in integer values.
2    Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18 
19 #ifndef _ASM_BITS_BYTESWAP_H
20 #define _ASM_BITS_BYTESWAP_H 1
21 
22 #define __bswap_non_constant_16(x) \
23      (__extension__							      \
24       ({ register unsigned short int __v;				      \
25 	 __asm__ __volatile__ ("shl %0 = %1, 48 ;;"			      \
26 				"mux1 %0 = %0, @rev ;;"			      \
27 				: "=r" (__v)				      \
28 				: "r" ((unsigned short int) (x)));	      \
29 	 __v; }))
30 
31 #define __bswap_non_constant_32(x) \
32      (__extension__							      \
33       ({ register unsigned int __v;					      \
34 	 __asm__ __volatile__ ("shl %0 = %1, 32 ;;"			      \
35 				"mux1 %0 = %0, @rev ;;"			      \
36 				: "=r" (__v)				      \
37 				: "r" ((unsigned int) (x)));		      \
38 	 __v; }))
39 
40 #define __bswap_non_constant_64(x) \
41      (__extension__							      \
42       ({ register unsigned long int __v;				      \
43 	 __asm__ __volatile__ ("mux1 %0 = %1, @rev ;;"			      \
44 				: "=r" (__v)				      \
45 				: "r" ((unsigned long int) (x)));	      \
46          __v; }))
47 #endif
48 
49 #include <bits/byteswap-common.h>
50