Revision fbbea48e libavutil/intreadwrite.h

View differences:

libavutil/intreadwrite.h
63 63

  
64 64
#  define AV_RL16(x)    bswap_16(AV_RN16(x))
65 65
#  define AV_WL16(p, d) AV_WN16(p, bswap_16(d))
66

  
67
#  define AV_RB32(x)    AV_RN32(x)
68
#  define AV_WB32(p, d) AV_WN32(p, d)
69

  
70
#  define AV_RL32(x)    bswap_32(AV_RN32(x))
71
#  define AV_WL32(p, d) AV_WN32(p, bswap_32(d))
72

  
73
#  define AV_RB64(x)    AV_RN64(x)
74
#  define AV_WB64(p, d) AV_WN64(p, d)
75

  
76
#  define AV_RL64(x)    bswap_64(AV_RN64(x))
77
#  define AV_WL64(p, d) AV_WN64(p, bswap_64(d))
66 78
# else /* WORDS_BIGENDIAN */
67 79
#  define AV_RB16(x)    bswap_16(AV_RN16(x))
68 80
#  define AV_WB16(p, d) AV_WN16(p, bswap_16(d))
69 81

  
70 82
#  define AV_RL16(x)    AV_RN16(x)
71 83
#  define AV_WL16(p, d) AV_WN16(p, d)
84

  
85
#  define AV_RB32(x)    bswap_32(AV_RN32(x))
86
#  define AV_WB32(p, d) AV_WN32(p, bswap_32(d))
87

  
88
#  define AV_RL32(x)    AV_RN32(x)
89
#  define AV_WL32(p, d) AV_WN32(p, d)
90

  
91
#  define AV_RB64(x)    bswap_64(AV_RN64(x))
92
#  define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
93

  
94
#  define AV_RL64(x)    AV_RN64(x)
95
#  define AV_WL64(p, d) AV_WN64(p, d)
72 96
# endif
73 97
#else /* HAVE_FAST_UNALIGNED */
74 98
#define AV_RB16(x)  ((((const uint8_t*)(x))[0] << 8) | ((const uint8_t*)(x))[1])
......
81 105
#define AV_WL16(p, d) do { \
82 106
                    ((uint8_t*)(p))[0] = (d); \
83 107
                    ((uint8_t*)(p))[1] = (d)>>8; } while(0)
84
#endif
85

  
86
#define AV_RB24(x)  ((((const uint8_t*)(x))[0] << 16) | \
87
                     (((const uint8_t*)(x))[1] <<  8) | \
88
                      ((const uint8_t*)(x))[2])
89
#define AV_WB24(p, d) do { \
90
                    ((uint8_t*)(p))[2] = (d); \
91
                    ((uint8_t*)(p))[1] = (d)>>8; \
92
                    ((uint8_t*)(p))[0] = (d)>>16; } while(0)
93

  
94
#define AV_RL24(x)  ((((const uint8_t*)(x))[2] << 16) | \
95
                     (((const uint8_t*)(x))[1] <<  8) | \
96
                      ((const uint8_t*)(x))[0])
97
#define AV_WL24(p, d) do { \
98
                    ((uint8_t*)(p))[0] = (d); \
99
                    ((uint8_t*)(p))[1] = (d)>>8; \
100
                    ((uint8_t*)(p))[2] = (d)>>16; } while(0)
101

  
102
#ifdef HAVE_FAST_UNALIGNED
103
# ifdef WORDS_BIGENDIAN
104
#  define AV_RB32(x)    AV_RN32(x)
105
#  define AV_WB32(p, d) AV_WN32(p, d)
106 108

  
107
#  define AV_RL32(x)    bswap_32(AV_RN32(x))
108
#  define AV_WL32(p, d) AV_WN32(p, bswap_32(d))
109
# else /* WORDS_BIGENDIAN */
110
#  define AV_RB32(x)    bswap_32(AV_RN32(x))
111
#  define AV_WB32(p, d) AV_WN32(p, bswap_32(d))
112

  
113
#  define AV_RL32(x)    AV_RN32(x)
114
#  define AV_WL32(p, d) AV_WN32(p, d)
115
# endif
116
#else /* HAVE_FAST_UNALIGNED */
117 109
#define AV_RB32(x)  ((((const uint8_t*)(x))[0] << 24) | \
118 110
                     (((const uint8_t*)(x))[1] << 16) | \
119 111
                     (((const uint8_t*)(x))[2] <<  8) | \
......
133 125
                    ((uint8_t*)(p))[1] = (d)>>8; \
134 126
                    ((uint8_t*)(p))[2] = (d)>>16; \
135 127
                    ((uint8_t*)(p))[3] = (d)>>24; } while(0)
136
#endif
137

  
138
#ifdef HAVE_FAST_UNALIGNED
139
# ifdef WORDS_BIGENDIAN
140
#  define AV_RB64(x)    AV_RN64(x)
141
#  define AV_WB64(p, d) AV_WN64(p, d)
142 128

  
143
#  define AV_RL64(x)    bswap_64(AV_RN64(x))
144
#  define AV_WL64(p, d) AV_WN64(p, bswap_64(d))
145
# else /* WORDS_BIGENDIAN */
146
#  define AV_RB64(x)    bswap_64(AV_RN64(x))
147
#  define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
148

  
149
#  define AV_RL64(x)    AV_RN64(x)
150
#  define AV_WL64(p, d) AV_WN64(p, d)
151
# endif
152
#else /* HAVE_FAST_UNALIGNED */
153 129
#define AV_RB64(x)  (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
154 130
                     ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
155 131
                     ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
......
185 161
                    ((uint8_t*)(p))[5] = (d)>>40; \
186 162
                    ((uint8_t*)(p))[6] = (d)>>48; \
187 163
                    ((uint8_t*)(p))[7] = (d)>>56; } while(0)
188
#endif
164
#endif  /* HAVE_FAST_UNALIGNED */
165

  
166
#define AV_RB24(x)  ((((const uint8_t*)(x))[0] << 16) | \
167
                     (((const uint8_t*)(x))[1] <<  8) | \
168
                      ((const uint8_t*)(x))[2])
169
#define AV_WB24(p, d) do { \
170
                    ((uint8_t*)(p))[2] = (d); \
171
                    ((uint8_t*)(p))[1] = (d)>>8; \
172
                    ((uint8_t*)(p))[0] = (d)>>16; } while(0)
173

  
174
#define AV_RL24(x)  ((((const uint8_t*)(x))[2] << 16) | \
175
                     (((const uint8_t*)(x))[1] <<  8) | \
176
                      ((const uint8_t*)(x))[0])
177
#define AV_WL24(p, d) do { \
178
                    ((uint8_t*)(p))[0] = (d); \
179
                    ((uint8_t*)(p))[1] = (d)>>8; \
180
                    ((uint8_t*)(p))[2] = (d)>>16; } while(0)
189 181

  
190 182
#endif /* FFMPEG_INTREADWRITE_H */

Also available in: Unified diff