#define U16 unsigned short #define U8DX unsigned char xdata * data UCDX GCDX232ptr; // receive rs 232 pointer U16 GStemp; ..... GStemp = (U16) GCDX232ptr; GStemp &= 0xFF00 ; GCDX232ptr = GStemp ; works, why does (U16) GCDX232ptr &= 0xFF00 ; not work
How about if you use a union?
that would work, I tried, however it makes the whole thing messy (the pointer is used as a pointer about 100 places and ANDed only once). I like "clean looking" code like the (U16) in the above example where the many places where the pointer is a pointer does not need multi.ptr but just ptr. More and more stuff get invented to make fast code more difficult because some want the compiler to protect them against themselves. That, of course alleviates the need for that awful thing called "thinking". Erik