??? 06/04/04 08:59 Read: times |
#71722 - RE: Little Endian Big endian conversion. Responding to: ???'s previous message |
hi,
Both formats are hardware-dependent and based on that how does hardware works (fetches words/longs from memory, puts them into stack etc). So generally, there is no way to recognize number format between Big and Little Endian in abstract system. In fact, both formats support full range of numbers and so, for example, 0x1234 may be as number of Big Endian form as same as Little Endian one. Sometimes, when you have additional conditions defined, it may be possible. For example, assume you know that input numbers must not be above 0xFF. Then you get incoming number 0x1200. So you know that it must be converted. Anyway, as I said: no way to recognize if we talk abstactly. Moreover this question of matter is not actual in the whole if we talk about 8051 - it does not support word/long memory manipulations directly by hardware. You may read/write memory locations only byte-by-byte (as long as you do not "hack" it playing with stack by which it is possible to push/pop return addresses, i.e. 16-bit values). Regards, Oleg |