Revision 63826ceb

View differences:

libavutil/intreadwrite.h
38 38
#endif
39 39

  
40 40
/*
41
 * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
42
 */
43

  
44
#if HAVE_BIGENDIAN
45

  
46
#   if    defined(AV_RN16) && !defined(AV_RB16)
47
#       define AV_RB16(p) AV_RN16(p)
48
#   elif !defined(AV_RN16) &&  defined(AV_RB16)
49
#       define AV_RN16(p) AV_RB16(p)
50
#   endif
51

  
52
#   if    defined(AV_WN16) && !defined(AV_WB16)
53
#       define AV_WB16(p, v) AV_WN16(p, v)
54
#   elif !defined(AV_WN16) &&  defined(AV_WB16)
55
#       define AV_WN16(p, v) AV_WB16(p, v)
56
#   endif
57

  
58
#   if    defined(AV_RN32) && !defined(AV_RB32)
59
#       define AV_RB32(p) AV_RN32(p)
60
#   elif !defined(AV_RN32) &&  defined(AV_RB32)
61
#       define AV_RN32(p) AV_RB32(p)
62
#   endif
63

  
64
#   if    defined(AV_RN24) && !defined(AV_RB24)
65
#       define AV_RB24(p) AV_RN24(p)
66
#   elif !defined(AV_RN24) &&  defined(AV_RB24)
67
#       define AV_RN24(p) AV_RB24(p)
68
#   endif
69

  
70
#   if    defined(AV_WN24) && !defined(AV_WB24)
71
#       define AV_WB24(p, v) AV_WN24(p, v)
72
#   elif !defined(AV_WN24) &&  defined(AV_WB24)
73
#       define AV_WN24(p, v) AV_WB24(p, v)
74
#   endif
75

  
76
#   if    defined(AV_WN32) && !defined(AV_WB32)
77
#       define AV_WB32(p, v) AV_WN32(p, v)
78
#   elif !defined(AV_WN32) &&  defined(AV_WB32)
79
#       define AV_WN32(p, v) AV_WB32(p, v)
80
#   endif
81

  
82
#   if    defined(AV_RN64) && !defined(AV_RB64)
83
#       define AV_RB64(p) AV_RN64(p)
84
#   elif !defined(AV_RN64) &&  defined(AV_RB64)
85
#       define AV_RN64(p) AV_RB64(p)
86
#   endif
87

  
88
#   if    defined(AV_WN64) && !defined(AV_WB64)
89
#       define AV_WB64(p, v) AV_WN64(p, v)
90
#   elif !defined(AV_WN64) &&  defined(AV_WB64)
91
#       define AV_WN64(p, v) AV_WB64(p, v)
92
#   endif
93

  
94
#else /* HAVE_BIGENDIAN */
95

  
96
#   if    defined(AV_RN16) && !defined(AV_RL16)
97
#       define AV_RL16(p) AV_RN16(p)
98
#   elif !defined(AV_RN16) &&  defined(AV_RL16)
99
#       define AV_RN16(p) AV_RL16(p)
100
#   endif
101

  
102
#   if    defined(AV_WN16) && !defined(AV_WL16)
103
#       define AV_WL16(p, v) AV_WN16(p, v)
104
#   elif !defined(AV_WN16) &&  defined(AV_WL16)
105
#       define AV_WN16(p, v) AV_WL16(p, v)
106
#   endif
107

  
108
#   if    defined(AV_RN32) && !defined(AV_RL32)
109
#       define AV_RL32(p) AV_RN32(p)
110
#   elif !defined(AV_RN32) &&  defined(AV_RL32)
111
#       define AV_RN32(p) AV_RL32(p)
112
#   endif
113

  
114
#   if    defined(AV_RN24) && !defined(AV_RL24)
115
#       define AV_RL24(p) AV_RN24(p)
116
#   elif !defined(AV_RN24) &&  defined(AV_RL24)
117
#       define AV_RN24(p) AV_RL24(p)
118
#   endif
119

  
120
#   if    defined(AV_WN24) && !defined(AV_WL24)
121
#       define AV_WL24(p, v) AV_WN24(p, v)
122
#   elif !defined(AV_WN24) &&  defined(AV_WL24)
123
#       define AV_WN24(p, v) AV_WL24(p, v)
124
#   endif
125

  
126
#   if    defined(AV_WN32) && !defined(AV_WL32)
127
#       define AV_WL32(p, v) AV_WN32(p, v)
128
#   elif !defined(AV_WN32) &&  defined(AV_WL32)
129
#       define AV_WN32(p, v) AV_WL32(p, v)
130
#   endif
131

  
132
#   if    defined(AV_RN64) && !defined(AV_RL64)
133
#       define AV_RL64(p) AV_RN64(p)
134
#   elif !defined(AV_RN64) &&  defined(AV_RL64)
135
#       define AV_RN64(p) AV_RL64(p)
136
#   endif
137

  
138
#   if    defined(AV_WN64) && !defined(AV_WL64)
139
#       define AV_WL64(p, v) AV_WN64(p, v)
140
#   elif !defined(AV_WN64) &&  defined(AV_WL64)
141
#       define AV_WN64(p, v) AV_WL64(p, v)
142
#   endif
143

  
144
#endif /* !HAVE_BIGENDIAN */
145

  
146
/*
41 147
 * Define AV_[RW]N helper macros to simplify definitions not provided
42 148
 * by per-arch headers.
43 149
 */
......
190 296
#endif
191 297

  
192 298
#if HAVE_BIGENDIAN
193
#   define AV_RB(s, p)    AV_RN(s, p)
194
#   define AV_WB(s, p, v) AV_WN(s, p, v)
195
#   define AV_RL(s, p)    bswap_##s(AV_RN(s, p))
196
#   define AV_WL(s, p, v) AV_WN(s, p, bswap_##s(v))
299
#   define AV_RB(s, p)    AV_RN##s(p)
300
#   define AV_WB(s, p, v) AV_WN##s(p, v)
301
#   define AV_RL(s, p)    bswap_##s(AV_RN##s(p))
302
#   define AV_WL(s, p, v) AV_WN##s(p, bswap_##s(v))
197 303
#else
198
#   define AV_RB(s, p)    bswap_##s(AV_RN(s, p))
199
#   define AV_WB(s, p, v) AV_WN(s, p, bswap_##s(v))
200
#   define AV_RL(s, p)    AV_RN(s, p)
201
#   define AV_WL(s, p, v) AV_WN(s, p, v)
304
#   define AV_RB(s, p)    bswap_##s(AV_RN##s(p))
305
#   define AV_WB(s, p, v) AV_WN##s(p, bswap_##s(v))
306
#   define AV_RL(s, p)    AV_RN##s(p)
307
#   define AV_WL(s, p, v) AV_WN##s(p, v)
202 308
#endif
203 309

  
204 310
#define AV_RB8(x)     (((const uint8_t*)(x))[0])

Also available in: Unified diff