|
|
1.1 root 1: /******************************************************************************
2: * Copyright (c) 2004, 2008 IBM Corporation
3: * All rights reserved.
4: * This program and the accompanying materials
5: * are made available under the terms of the BSD License
6: * which accompanies this distribution, and is available at
7: * http://www.opensource.org/licenses/bsd-license.php
8: *
9: * Contributors:
10: * IBM Corporation - initial implementation
11: *****************************************************************************/
12:
13:
14: #ifndef MY_ENDIAN_H
15: #define MY_ENDIAN_H
16:
17: #include <stdint.h>
18:
19: extern inline uint16_t bswap_16 (uint16_t x);
20: extern inline uint32_t bswap_32 (uint32_t x);
21: extern inline uint64_t bswap_64 (uint64_t x);
22: #define CPU_BIG_ENDIAN
23:
24: #ifndef CPU_BIG_ENDIAN
25: #define cpu_to_le64(x) (x)
26: #define cpu_to_le32(x) (x)
27: #define cpu_to_le16(x) (x)
28: #define cpu_to_be16(x) bswap_16(x)
29: #define cpu_to_be32(x) bswap_32(x)
30: #define le64_to_cpu(x) (x)
31: #define le32_to_cpu(x) (x)
32: #define le16_to_cpu(x) (x)
33: #define be32_to_cpu(x) bswap_32(x)
34: #else
35: #define cpu_to_le64(x) bswap_64(x)
36: #define cpu_to_le32(x) bswap_32(x)
37: #define cpu_to_le16(x) bswap_16(x)
38: #define cpu_to_be16(x) (x)
39: #define cpu_to_be32(x) (x)
40: #define le64_to_cpu(x) bswap_64(x)
41: #define le32_to_cpu(x) bswap_32(x)
42: #define le16_to_cpu(x) bswap_16(x)
43: #define be32_to_cpu(x) (x)
44: #endif
45:
46: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.