#include #include static uint getdword_n(void *mem, int n) { STATIC uint tmp = 0; switch (n) { case 3: ((uchar*)&tmp)[1] = ((uchar*)mem)[2]; case 2: ((uchar*)&tmp)[2] = ((uchar*)mem)[1]; case 1: ((uchar*)&tmp)[3] = ((uchar*)mem)[0]; default: break; } return tmp; } void main(void) { uint x; char buf[] = "xxxx"; x = getdword_n(buf, 2); print("%x\n", x); }