Link Here
|
129 |
return std::string(reinterpret_cast<char*>(&x), 4); |
129 |
return std::string(reinterpret_cast<char*>(&x), 4); |
130 |
} |
130 |
} |
131 |
#else |
131 |
#else |
132 |
#error "Write be-to-le conversion functions" |
132 |
static inline void WriteLE16(uint16_t* f, uint16_t x) { |
|
|
133 |
*f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff); |
134 |
} |
135 |
|
136 |
static inline void WriteLE32(uint32_t* f, uint32_t x) { |
137 |
*f = ( (x & 0x000000ff) << 24 ) |
138 |
| ((x & 0x0000ff00) << 8) |
139 |
| ((x & 0x00ff0000) >> 8) |
140 |
| ((x & 0xff000000) >> 24 ); |
141 |
} |
142 |
|
143 |
static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { |
144 |
*f = (static_cast<uint32_t>(a) << 24 ) |
145 |
| (static_cast<uint32_t>(b) << 16) |
146 |
| (static_cast<uint32_t>(c) << 8) |
147 |
| (static_cast<uint32_t>(d) ); |
148 |
} |
149 |
|
150 |
static inline uint16_t ReadLE16(uint16_t x) { |
151 |
return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8); |
152 |
} |
153 |
|
154 |
static inline uint32_t ReadLE32(uint32_t x) { |
155 |
return ( (x & 0x000000ff) << 24 ) |
156 |
| ( (x & 0x0000ff00) << 8 ) |
157 |
| ( (x & 0x00ff0000) >> 8) |
158 |
| ( (x & 0xff000000) >> 24 ); |
159 |
} |
160 |
|
161 |
static inline std::string ReadFourCC(uint32_t x) { |
162 |
x = ReadLE32(x); |
163 |
return std::string(reinterpret_cast<char*>(&x), 4); |
164 |
} |
133 |
#endif |
165 |
#endif |
134 |
|
166 |
|
135 |
static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { |
167 |
static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { |