I am getting really confused now, if i have a signed value for example -634, what will the MSB and LSB of the number?
Printable View
I am getting really confused now, if i have a signed value for example -634, what will the MSB and LSB of the number?
Assuming two's complement representation, -634 in 16 bits has the same bit pattern as 2**16 - 634 = 65536 - 634 = 64902 which in hex is 0xFD86. So the MSB is 0xFD and the LSB is 0x86. However, the order that the MSB and LSB are stored in memory depends on the endianness of your system. If it is little-endian then 0x86 will appear first (lower in memory) and 0xFD will appear after that.
Intel/AMD architecture are Little-Endian by default. There are compiler options in most compilers to change that.
See the Wikipedia article for more information.
It's apparently useless trying to help this person.
He's also asking the same or similar questions in multiple threads.
And his initial thread says he is writing the code for a "customer".
That customer is being ripped off since obviously doesn't know what he's doing.
And how do we get our cut of the profits?