Bit numbering
From Wikipedia, the free encyclopedia
In computing, bit numbering (or sometimes bit endianness) is the convention used to identify the bit positions in a binary number or a container for such a value. The bit number starts with zero and is incremented by one for each subsequent bit position.
Contents |
[edit] LSB 0 bit numbering
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 using exponentiation with the bit number and a base of 2.
[edit] MSB 0 bit numbering
Similarly, when the bit numbering starts at zero for the most significant bit the numbering scheme is called "MSB 0".
[edit] Usage
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 and PA-RISC use "MSB 0".[2]
The IETF RFC2360 documents use "MSB 0" bit numbering.[citation needed]
Bit numbering is usually transparent to the software, but some programming languages like Ada allow specifying the appropriate bit order for data type representation.[3]
[edit] See also
[edit] References
- ^ Langdon, Glen G. (1982). Computer Design. Computeach Press Inc. p. 52. ISBN 0-9607864-0-6.
- ^ David V. James (June 1990). "Multiplexed buses: the endian wars continue". IEEE Micro 10 (3): 9–21. doi:. ISSN 0272-1732. http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=56322. Retrieved 2008-12-20. "their first bits and nibbles came from ALU chips, which map zero (0) to the least significant bit. (...) some (otherwise) big-endian designers insist on using the little-endian notation to describe bits and the big-endian notation to describe bytes. (...) Note that IBM (on the S/360 and 370) and Hewlett-Packard (on the PA-RISC processor) consistently map zero to the MSB".
- ^ Norman H. Cohen (January 1994). "Endian-independent record representation clauses". Ada Letters (ACM SIGAda) XIV (1): 27–29. ISSN 1094-3641. http://researchweb.watson.ibm.com/people/n/ncohen/EndianIndepRecRepClauses.pdf. Retrieved 2008-12-20.
[edit] External links
- Bit Numbers
- Bit numbering for different CPUs:
- Motorola 68000 ("Bit manipulation" and "Reversed Bit-Numbering" sections)
- IBM Cell Broadband Processors ("Byte ordering and bit numbering")