全部博文(413)
分类: C/C++
2011-09-08 10:28:53
When the bit numbering starts at zero for the least significant bit the numbering scheme is called "LSB 0".[1] This bit numbering method has the advantage that for any unsigned integral data type the value of the number can be calculated by usingexponentiation with the bit number and a base of 2.
MSB 0 bit numbering
Similarly, when the bit numbering starts at zero for the most significant bit the numbering scheme is called "MSB 0".
Little-endian CPUs usually employ "LSB 0" bit numbering, however both bit numbering conventions can be seen in big-endian machines.
Some architectures like SPARC and Motorola 68000 use "LSB 0" bit numbering, while S/390, PowerPC and PA-RISCuse "MSB 0".[2]
The recommended style for Request for Comments documents is "MSB 0" bit numbering.[3]
Bit numbering is usually transparent to the software, but some programming languages like Ada allow specifying the appropriate bit order for data type representation.[4]