18typedef unsigned char BOOL;
19typedef unsigned char BOOLEAN;
20typedef volatile unsigned char VBOOLEAN;
21typedef VBOOLEAN *PVBOOLEAN;
22typedef BOOLEAN *PBOOLEAN;
23typedef const BOOLEAN *PCBOOLEAN;
25typedef const char *PCSTR;
41typedef signed char int8_t;
42typedef unsigned char uint8_t;
43typedef volatile signed char vint8_t;
44typedef volatile unsigned char vuint8_t;
46typedef signed short int16_t;
47typedef unsigned short uint16_t;
48typedef volatile signed short vint16_t;
49typedef volatile unsigned short vuint16_t;
51typedef signed long int32_t;
52typedef unsigned long uint32_t;
53typedef volatile signed long vint32_t;
54typedef volatile unsigned long vuint32_t;
56typedef signed long long int64_t;
57typedef unsigned long long uint64_t;
58typedef volatile signed long long vint64_t;
59typedef volatile unsigned long long vuint64_t;
61typedef signed char INT8;
62typedef unsigned char UINT8;
63typedef volatile signed char VINT8;
64typedef volatile unsigned char VUINT8;
66typedef signed short INT16;
67typedef unsigned short UINT16;
68typedef volatile signed short VINT16;
69typedef volatile unsigned short VUINT16;
71typedef signed long INT32;
72typedef unsigned long UINT32;
73typedef volatile signed long VINT32;
74typedef volatile unsigned long VUINT32;
76typedef vuint8_t *pvuint8_t;
77typedef vint8_t *pvint8_t;
78typedef vint16_t *pvint16_t;
79typedef vuint16_t *pvuint16_t;
80typedef vuint32_t *pvuint32_t;
81typedef vint32_t *pvint32_t;
83typedef unsigned char *puint8_t;
84typedef signed char *pint8_t;
85typedef signed short *pint16_t;
86typedef unsigned short *puint16_t;
87typedef unsigned long *puint32_t;
88typedef signed long *pint32_t;
90typedef const unsigned char *pcuint8_t;
91typedef const signed char *pcint8_t;
92typedef const signed short *pcint16_t;
93typedef const unsigned short *pcuint16_t;
94typedef const unsigned long *pcuint32_t;
95typedef const signed long *pcint32_t;
97#define beint16_t int16_t
98#define beuint16_t uint16_t
99#define beuint32_t uint32_t
100#define beint32_t int32_t
102#define pbeint16_t pint16_t
103#define pbeuint16_t puint16_t
104#define pbeuint32_t puint32_t
105#define pbeint32_t pint32_t
107#define vbeint16_t vint16_t
108#define vbeuint16_t vuint16_t
109#define vbeuint32_t vuint32_t
110#define vbeint32_t vint32_t
112#define pvbeint16_t pvint16_t
113#define pvbeuint16_t pvuint16_t
114#define pvbeuint32_t pvuint32_t
115#define pvbeint32_t pvint32_t
117typedef float befloat;
118typedef double bedouble;
119typedef volatile float vbefloat;
120typedef volatile double vbedouble;
121typedef float *pbefloat;
122typedef double *pbedouble;
123typedef volatile float *pvbefloat;
124typedef volatile double *pvbedouble;
127typedef volatile bool vbool_t;
128typedef bool *pbool_t;
129typedef vbool_t *pvbool_t;
131inline uint16_t __REV16(uint16_t v)
133 return ((v >> 8) & 0xFF) + ((v << 8) & 0xFF00);
135inline int16_t __REVSH(int16_t v)
137 return ((v >> 8) & 0xFF) + ((v << 8) & 0xFF00);
139inline uint32_t __REV(uint32_t v)
141 return ((v >> 24) & 0XFF) + ((v >> 8) & 0XFF00) + ((v << 24) & 0XFF000000) + ((v << 8) & 0x00FF0000);
143inline int32_t __REV(int32_t v)
145 return ((v >> 24) & 0XFF) + ((v >> 8) & 0XFF00) + ((v << 24) & 0XFF000000) + ((v << 8) & 0x00FF0000);
149void * memcpy(
void *,
const void*,
size_t);
150inline float __REV(
float f)
153 memcpy(&v, &f,
sizeof(
float));
154 v = ((v >> 24) & 0XFF) + ((v >> 8) & 0XFF00) + ((v << 24) & 0XFF000000) + ((v << 8) & 0x00FF0000);
155 memcpy(&f, &v,
sizeof(
float));
168 inline LEu16(T rhs) : val(__REV16(rhs)) {}
169 inline LEu16(uint32_t &rhs) : val(__REV16((uint16_t)rhs)) {}
170 inline T operator=(T rhs)
175 inline operator T()
const {
return __REV16(val); }
176 inline explicit operator uint32_t()
const {
return __REV16(val); }
177 inline T getMem() {
return val; }
179 inline T operator^=(T rhs)
184 inline T operator|=(T rhs)
189 inline T operator&=(T rhs)
194 inline T operator%=(T rhs)
196 T ret = __REV16(val) % rhs;
200 inline T operator+=(T rhs)
202 T ret = __REV16(val) + rhs;
206 inline T operator-=(T rhs)
208 T ret = __REV16(val) - rhs;
213 inline T operator++()
215 T ret = __REV16(val) + 1;
219 inline T operator--()
221 T ret = __REV16(val) - 1;
225 inline T operator++(
int)
227 T ret = __REV16(val);
228 val = __REV16(ret + 1);
231 inline T operator--(
int)
233 T ret = __REV16(val);
234 val = __REV16(ret - 1);
237} __attribute__((packed));
247 inline LEs16(T rhs) : val(__REV16(rhs)) {}
248 inline LEs16(int32_t &rhs) : val(__REVSH((int16_t)rhs)) {}
249 inline T operator=(T rhs)
254 inline operator T()
const {
return __REVSH(val); }
255 inline explicit operator int32_t()
const {
return (int32_t)(__REV16(val)); }
256 inline T getMem() {
return val; }
258 inline T operator^=(T rhs)
263 inline T operator|=(T rhs)
268 inline T operator&=(T rhs)
273 inline T operator%=(T rhs)
275 T ret = __REVSH(val) % rhs;
279 inline T operator+=(T rhs)
281 T ret = __REVSH(val) + rhs;
285 inline T operator-=(T rhs)
287 T ret = __REVSH(val) - rhs;
292 inline T operator++()
294 T ret = __REVSSH(val) + 1;
298 inline T operator--()
300 T ret = __REVSH(val) - 1;
304 inline T operator++(
int)
306 T ret = __REVSH(val);
307 val = __REVSH(ret + 1);
310 inline T operator--(
int)
312 T ret = __REVSH(val);
313 val = __REVSH(ret - 1);
316} __attribute__((packed));
326 inline LE32(T rhs) : val(__REV(rhs)) {}
328 inline T operator=(T rhs)
333 inline operator T()
const {
return __REV(val); }
334 inline T getMem() {
return val; }
336 inline T operator^=(T rhs)
341 inline T operator|=(T rhs)
346 inline T operator&=(T rhs)
351 inline T operator%=(T rhs)
353 T ret = __REV(val) % rhs;
357 inline T operator+=(T rhs)
359 T ret = __REV(val) + rhs;
363 inline T operator-=(T rhs)
365 T ret = __REV(val) - rhs;
370 inline T operator++()
372 T ret = __REVSSH(val) + 1;
376 inline T operator--()
378 T ret = __REV(val) - 1;
382 inline T operator++(
int)
385 val = __REV(ret + 1);
388 inline T operator--(
int)
391 val = __REV(ret - 1);
395} __attribute__((packed));
405 LE_Float() =
default;
407 inline LE_Float(
float rhs) : val(__REV(rhs)) {}
409 inline float operator=(
float rhs)
414 inline operator float()
const {
return __REV(val); }
415 inline float getMem() {
return val; }
417 inline float operator+=(
float rhs)
419 float ret = __REV(val) + rhs;
423 inline float operator-=(
float rhs)
425 float ret = __REV(val) - rhs;
430 inline float operator++()
432 float ret = __REV(val) + 1;
436 inline float operator--()
438 float ret = __REV(val) - 1;
442 inline float operator++(
int)
444 float ret = __REV(val);
445 val = __REV(ret + 1);
448 inline float operator--(
int)
450 float ret = __REV(val);
451 val = __REV(ret - 1);
455 inline float operator=(
float rhs)
volatile
460 inline float getMem()
volatile {
return val; }
461 inline operator float()
const volatile {
return __REV(val); }
463 inline float operator+=(
float rhs)
volatile
465 float ret = __REV(val) + rhs;
469 inline float operator-=(
float rhs)
volatile
471 float ret = __REV(val) - rhs;
476 inline float operator++()
volatile
478 float ret = __REV(val) + 1;
482 inline float operator--()
volatile
484 float ret = __REV(val) - 1;
488 inline float operator++(
int)
volatile
490 float ret = __REV(val);
491 val = __REV(ret + 1);
494 inline float operator--(
int)
volatile
496 float ret = __REV(val);
497 val = __REV(ret - 1);
505} __attribute__((packed));
515 LE_Double() =
default;
517 inline LE_Double(
double rhs)
519 (uint8_t)(((uint64_t)rhs)>>56),(uint8_t)(((uint64_t)rhs)>>48),
520 (uint8_t)(((uint64_t)rhs)>>40),(uint8_t)(((uint64_t)rhs)>>32),
521 (uint8_t)(((uint64_t)rhs)>>24),(uint8_t)(((uint64_t)rhs)>>16),
522 (uint8_t)(((uint64_t)rhs)>> 8),(uint8_t)(((uint64_t)rhs)>> 0)
526 inline double operator=(
double rhs)
528 valBuf[0] = (uint8_t)(((uint64_t)rhs)>>56);
529 valBuf[1] = (uint8_t)(((uint64_t)rhs)>>48),
530 valBuf[2] = (uint8_t)(((uint64_t)rhs)>>40);
531 valBuf[3] = (uint8_t)(((uint64_t)rhs)>>32);
532 valBuf[4] = (uint8_t)(((uint64_t)rhs)>>24);
533 valBuf[5] = (uint8_t)(((uint64_t)rhs)>>16);
534 valBuf[6] = (uint8_t)(((uint64_t)rhs)>> 8);
535 valBuf[7] = (uint8_t)(((uint64_t)rhs)>> 0);
538 inline operator double()
const
542 (((uint64_t)valBuf[0])<<56) | (((uint64_t)valBuf[0])<<48)
543 | (((uint64_t)valBuf[0])<<40) | (((uint64_t)valBuf[0])<<32)
544 | (((uint64_t)valBuf[0])<<24) | (((uint64_t)valBuf[0])<<16)
545 | (((uint64_t)valBuf[0])<< 8) | (((uint64_t)valBuf[0])<< 0)
548 inline double getMem() {
return val; }
550 inline double operator+=(
double rhs)
552 double ret = ((double)(*
this)) + rhs;
556 inline double operator-=(
double rhs)
558 double ret = ((double)(*
this)) - rhs;
563 inline double operator++()
565 double ret = ((double)(*
this)) + 1;
569 inline double operator--()
571 double ret = ((double)(*
this)) - 1;
575 inline double operator++(
int)
577 double ret = ((double)(*
this));
581 inline double operator--(
int)
583 double ret = ((double)(*
this));
588 inline double operator=(
double rhs)
volatile
590 valBuf[0] = (uint8_t)(((uint64_t)rhs)>>56);
591 valBuf[1] = (uint8_t)(((uint64_t)rhs)>>48),
592 valBuf[2] = (uint8_t)(((uint64_t)rhs)>>40);
593 valBuf[3] = (uint8_t)(((uint64_t)rhs)>>32);
594 valBuf[4] = (uint8_t)(((uint64_t)rhs)>>24);
595 valBuf[5] = (uint8_t)(((uint64_t)rhs)>>16);
596 valBuf[6] = (uint8_t)(((uint64_t)rhs)>> 8);
597 valBuf[7] = (uint8_t)(((uint64_t)rhs)>> 0);
600 inline double getMem()
volatile {
return val; }
601 inline operator double()
const volatile
605 (((uint64_t)valBuf[0])<<56) | (((uint64_t)valBuf[0])<<48)
606 | (((uint64_t)valBuf[0])<<40) | (((uint64_t)valBuf[0])<<32)
607 | (((uint64_t)valBuf[0])<<24) | (((uint64_t)valBuf[0])<<16)
608 | (((uint64_t)valBuf[0])<< 8) | (((uint64_t)valBuf[0])<< 0)
612 inline double operator+=(
double rhs)
volatile
614 double ret = ((double)(*
this)) + rhs;
618 inline double operator-=(
double rhs)
volatile
620 double ret = ((double)(*
this)) - rhs;
625 inline double operator++()
volatile
627 double ret = ((double)(*
this)) + 1;
631 inline double operator--()
volatile
633 double ret = ((double)(*
this)) - 1;
637 inline double operator++(
int)
volatile
639 double ret = ((double)(*
this));
643 inline double operator--(
int)
volatile
645 double ret = ((double)(*
this));
654} __attribute__((packed));
656typedef LEs16<int16_t> leint16_t;
657typedef LEu16<uint16_t> leuint16_t;
658typedef LE32<uint32_t> leuint32_t;
659typedef LE32<uint32_t> leint32_t;
661typedef LEs16<int16_t> *pleint16_t;
662typedef LEu16<uint16_t> *pleuint16_t;
663typedef LE32<uint32_t> *pleuint32_t;
664typedef LE32<uint32_t> *pleint32_t;
666typedef LEs16<volatile int16_t> vleint16_t;
667typedef LEu16<volatile uint16_t> vleuint16_t;
668typedef LE32<volatile uint32_t> vleuint32_t;
669typedef LE32<volatile uint32_t> vleint32_t;
671typedef LEs16<volatile int16_t> *pvleint16_t;
672typedef LEu16<volatile uint16_t> *pvleuint16_t;
673typedef LE32<volatile uint32_t> *pvleuint32_t;
674typedef LE32<volatile uint32_t> *pvleint32_t;
676typedef LE_Float lefloat;
677typedef LE_Double ledouble;
678typedef volatile LE_Float vlefloat;
679typedef volatile LE_Double vledouble;
680typedef LE_Float *plefloat;
681typedef LE_Double *pledouble;
682typedef volatile LE_Float *pvlefloat;
683typedef volatile LE_Double *pvledouble;
685#ifdef MAKE_LEINT_TEST
695 iprintf(
"int16_t=%08X\r\n", (
int)(*((int16_t *)buf)));
696 iprintf(
"uint16_t=%08X\r\n", (
unsigned int)(*((uint16_t *)buf)));
697 iprintf(
"int32_t=%08X\r\n", (
int)(*((int32_t *)buf)));
698 iprintf(
"uint32_t=%08X\r\n", (
unsigned int)(*((uint32_t *)buf)));
700 iprintf(
"leint16_t=%08X\r\n", (
int)(*((leint16_t *)buf)));
701 iprintf(
"leuint16_t=%08X\r\n", (
unsigned int)(*((leuint16_t *)buf)));
702 iprintf(
"leint32_t=%08X\r\n", (
int)(*((leint32_t *)buf)));
703 iprintf(
"leuint32_t=%08X\r\n", (
unsigned int)(*((leuint32_t *)buf)));
708#define uint32_t_max (0xFFFFFFFF)