summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/cris/bits/byteswap.h
blob: a82f9c0987d8c4a66f7363aee8955cb89b2b7d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef _ASM_BITS_BYTESWAP_H
#define _ASM_BITS_BYTESWAP_H 1

/* CRIS specific byte swap operations: 16, 32 and 64-bit */

#define __bswap_non_constant_16(x) \
	__extension__ 							\
	({ unsigned short __bswap_16_v; 				\
	   __asm__ ("swapb %0" : "=r" (__bswap_16_v) : "0" (x)); 	\
	   __bswap_16_v; })

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

#endif

#include <bits/byteswap-common.h>