I'm looking for the most efficient way (in terms of code size first, but speed is also an issue) of doing a little-endian to big-endian convertion on a DWORD. The commonly-used C macro: #define SWAP32(x) (((x) & 0xff) << 24 | ((x) & 0xff00) << 8 | ((x) & 0xff0000) >> 8 | ((x) >> 24) & 0xff) produces terrible code on the 8051. I'm looking for either a macro or a function that would perform the equivalent swap using the minimum number of instructions. The macro/function is called in lots of places in my code and code size has become an issue. Thanks! Ran Shalgi