ia64/xen-unstable

view extras/mini-os/include/byteswap.h @ 19836:d9890e67d2b7

tools: add SHAREDIR to buildmakevars2file

c/s 19818 dropped SHAREDIR from xen/util/path.py, which broke the "xm
new" command. This patch adds SHAREDIR back to the new
buildmakevars2file-closure function.

Signed-off-by: Ryan O'Connor <rjo@cs.ubc.ca>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:05:10 2009 +0100 (2009-06-25)
parents 707e10c9a487
children
line source
1 #ifndef _BYTESWAP_H_
2 #define _BYTESWAP_H_
4 /* Unfortunately not provided by newlib. */
6 #include <mini-os/types.h>
7 static inline uint16_t bswap_16(uint16_t x)
8 {
9 return
10 ((((x) & 0xff00) >> 8) | (((x) & 0xff) << 8));
11 }
13 static inline uint32_t bswap_32(uint32_t x)
14 {
15 return
16 ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |
17 (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
18 }
20 static inline uint64_t bswap_64(uint64_t x)
21 {
22 return
23 ((((x) & 0xff00000000000000ULL) >> 56) |
24 (((x) & 0x00ff000000000000ULL) >> 40) |
25 (((x) & 0x0000ff0000000000ULL) >> 24) |
26 (((x) & 0x000000ff00000000ULL) >> 8) |
27 (((x) & 0x00000000ff000000ULL) << 8) |
28 (((x) & 0x0000000000ff0000ULL) << 24) |
29 (((x) & 0x000000000000ff00ULL) << 40) |
30 (((x) & 0x00000000000000ffULL) << 56));
31 }
33 #endif /* _BYTESWAP_H */