1 /*************************************************************************
3 * 4F, No. 2 Technology 5th Rd. *
4 * Science-based Industrial Park *
5 * Hsin-chu, Taiwan, R.O.C. *
7 * (c) Copyright 2002, Ralink Technology, Inc. *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 * This program is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17 * GNU General Public License for more details. *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program; if not, write to the *
21 * Free Software Foundation, Inc., *
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 *************************************************************************
33 -------- ---------- ----------------------------------------------
34 Name Date Modification logs
37 #ifndef __RTMP_TYPE_H__
38 #define __RTMP_TYPE_H__
40 // Put platform dependent declaration here
41 // For example, linux type definition
44 typedef unsigned short UINT16
;
45 typedef unsigned long UINT32
;
46 typedef unsigned long long UINT64
;
52 #undef BIG_ENDIAN // Only little endian foe WIN32 system
54 typedef unsigned short UINT16
;
55 typedef unsigned long UINT32
;
56 typedef unsigned __int64 UINT64
;
60 // Endian byte swapping codes
65 (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \
66 (((UINT16)(x) & (UINT16) 0xff00U) >> 8) ))
70 (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \
71 (((UINT32)(x) & (UINT32) 0x0000ff00UL) << 8) | \
72 (((UINT32)(x) & (UINT32) 0x00ff0000UL) >> 8) | \
73 (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) ))
77 (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \
78 (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \
79 (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \
80 (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) << 8) | \
81 (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >> 8) | \
82 (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \
83 (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \
84 (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) ))
93 #define PACKED __attribute__ ((packed))
97 #define cpu2le64(x) SWAP64((x))
98 #define le2cpu64(x) SWAP64((x))
99 #define cpu2le32(x) SWAP32((x))
100 #define le2cpu32(x) SWAP32((x))
101 #define cpu2le16(x) SWAP16((x))
102 #define le2cpu16(x) SWAP16((x))
103 #define cpu2be64(x) ((UINT64)(x))
104 #define be2cpu64(x) ((UINT64)(x))
105 #define cpu2be32(x) ((UINT32)(x))
106 #define be2cpu32(x) ((UINT32)(x))
107 #define cpu2be16(x) ((UINT16)(x))
108 #define be2cpu16(x) ((UINT16)(x))
110 #else // Little_Endian
112 #define cpu2le64(x) ((UINT64)(x))
113 #define le2cpu64(x) ((UINT64)(x))
114 #define cpu2le32(x) ((UINT32)(x))
115 #define le2cpu32(x) ((UINT32)(x))
116 #define cpu2le16(x) ((UINT16)(x))
117 #define le2cpu16(x) ((UINT16)(x))
118 #define cpu2be64(x) SWAP64((x))
119 #define be2cpu64(x) SWAP64((x))
120 #define cpu2be32(x) SWAP32((x))
121 #define be2cpu32(x) SWAP32((x))
122 #define cpu2be16(x) SWAP16((x))
123 #define be2cpu16(x) SWAP16((x))
127 #endif // __RTMP_TYPE_H__