summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/v850/bits/byteswap.h
blob: b2e1ddb9098bec24ce8f024aadbe868c111f3a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * libc/sysdeps/linux/v850/bits/byteswap.h -- Macros to swap the order
 * 	of bytes in integer values
 *
 *  Copyright (C) 2001  NEC Corporation
 *  Copyright (C) 2001  Miles Bader <miles@gnu.org>
 *  Copyright (C) 1997,1998,2001  Free Software Foundation, Inc.
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License.  See the file COPYING.LIB in the main
 * directory of this archive for more details.
 */

#ifndef _ASM_BITS_BYTESWAP_H
#define _ASM_BITS_BYTESWAP_H 1

#define __bswap_non_constant_16(x) \
    (__extension__							      \
     ({ unsigned long int __bswap_16_v;					      \
	__asm__ ("bsh %1, %0" : "=r" (__bswap_16_v) : "r" (x));		      \
	__bswap_16_v; }))

# define __bswap_non_constant_32(x) \
    (__extension__							      \
     ({ unsigned long int __bswap_32_v;					      \
	__asm__ ("bsw %1, %0" : "=r" (__bswap_32_v) : "r" (x));		      \
	__bswap_32_v; }))

#endif

#include <bits/byteswap-common.h>