usb.patch, with conflicts and some warnings fixed
[pintos-anon] / src / lib / endian.h
1 #ifndef __LIB_ENDIAN_H
2 #define __LIB_ENDIAN_H
3
4
5 #define endian_swap32(x)       ((((x) & 0xff000000) >> 24) | \
6                                    (((x) & 0x00ff0000) >> 8)  | \
7                                    (((x) & 0x0000ff00) << 8)  | \
8                                    (((x) & 0x000000ff) << 24))
9 #define endian_swap16(x)        ((((x) & 0xff00)>> 8) | (((x) & 0x00ff) << 8))
10 #define endian_swap24(x)        (((x) >> 16) & 0xff) | (((x) & 0xff) << 16) | ((x) & 0xff00)
11
12 #define be32_to_machine(x)      endian_swap32(x)
13 #define be16_to_machine(x)      endian_swap16(x)
14 #define be24_to_machine(x)      endian_swap24(x)
15 #define machine_to_be32(x)      endian_swap32(x)
16 #define machine_to_be16(x)      endian_swap16(x)
17 #define machine_to_be24(x)      endian_swap24(x)
18
19 #endif