Cross Reference: i386_byteswap.h
xref
: /
osnet-11
/
usr
/
src
/
grub
/
grub-0.97
/
netboot
/
i386_byteswap.h
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
#
ifndef
ETHERBOOT_BITS_BYTESWAP_H
1
N/A
#
define
ETHERBOOT_BITS_BYTESWAP_H
1
N/A
1
N/A
#
include
"
types.h
"
1
N/A
static
inline
uint16_t
__i386_bswap_16
(
uint16_t
x)
1
N/A
{
1
N/A
__asm__
(
"xchgb %b0,%h0\n\t"
1
N/A
:
"=q"
(x)
1
N/A
:
"0"
(x));
1
N/A
return
x;
1
N/A
}
1
N/A
1
N/A
static
inline
uint32_t
__i386_bswap_32
(
uint32_t
x)
1
N/A
{
1
N/A
__asm__
(
"xchgb %b0,%h0\n\t"
1
N/A
"rorl $16,%0\n\t"
1
N/A
"xchgb %b0,%h0"
1
N/A
:
"=q"
(x)
1
N/A
:
"0"
(x));
1
N/A
return
x;
1
N/A
}
1
N/A
1
N/A
1
N/A
#
define
__bswap_constant_16
(x) \
1
N/A
((
uint16_t
)((((
uint16_t
)(x) &
0x00ff
) <<
8
) | \
1
N/A
(((
uint16_t
)(x) &
0xff00
) >>
8
)))
1
N/A
1
N/A
#
define
__bswap_constant_32
(x) \
1
N/A
((
uint32_t
)((((
uint32_t
)(x) &
0x000000ffU
) <<
24
) | \
1
N/A
(((
uint32_t
)(x) &
0x0000ff00U
) <<
8
) | \
1
N/A
(((
uint32_t
)(x) &
0x00ff0000U
) >>
8
) | \
1
N/A
(((
uint32_t
)(x) &
0xff000000U
) >>
24
)))
1
N/A
1
N/A
#
define
__bswap_16
(x) \
1
N/A
(
__builtin_constant_p
(x) ? \
1
N/A
__bswap_constant_16
(x) : \
1
N/A
__i386_bswap_16
(x))
1
N/A
1
N/A
1
N/A
#
define
__bswap_32
(x) \
1
N/A
(
__builtin_constant_p
(x) ? \
1
N/A
__bswap_constant_32
(x) : \
1
N/A
__i386_bswap_32
(x))
1
N/A
1
N/A
1
N/A
#
endif
/* ETHERBOOT_BITS_BYTESWAP_H */