blob: 3bc5efefe8eb8043118be83411fe8033cf7ec787 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#ifndef BYTESWAP_WIN_H_
#define BYTESWAP_WIN_H_
#include <stdint.h>
static inline uint16_t bswap_16(uint16_t v)
{
return (v << 8) | (v >> 8);
}
static inline uint32_t bswap_32(uint32_t v)
{
return ((v << 24) & 0xFF000000u) |
((v << 8) & 0x00FF0000u) |
((v >> 8) & 0x0000FF00u) |
((v >> 24) & 0x000000FFu);
}
#endif /* BYTESWAP_WIN_H_ */
|