| 1 |
#include <stdint.h> |
| 2 |
#include <stdbool.h> |
| 3 |
|
| 4 |
static bool littleendian=true; |
| 5 |
|
| 6 |
uint16_t bigendc16(union{uint16_t * n;uint8_t* b;}x){ |
| 7 |
|
| 8 |
if (!littleendian) return *x.n; |
| 9 |
|
| 10 |
uint16_t res = ((uint16_t)(x.b[1])<<0) | |
| 11 |
((uint16_t)(x.b[0])<<8); |
| 12 |
return res; |
| 13 |
} |
| 14 |
|