Jump to content

Bit numbering

From Wikipedia, the free encyclopedia
(Redirected fromMost significant bit)

Incomputing,bit numberingis the convention used to identify thebitpositions in abinary number.

Bit significance and indexing

[edit]
Thebinary representationof decimal 149, with the LSb highlighted. The LSb represents a value of 1.
The unsignedbinaryrepresentation of decimal 149, with the MSb highlighted. The MSb represents a value of 128.

Incomputing,theleast significant bit(LSb) is thebitposition in abinaryintegerrepresenting the binary 1s place of the integer. Similarly, themost significant bit(MSb) represents the highest-order place of the binary integer. The LSb is sometimes referred to as thelow-order bitorright-most bit,due to the convention inpositional notationof writing less significant digits further to the right. The MSb is similarly referred to as thehigh-order bitorleft-most bit.In both cases, the LSb and MSb correlate directly to the least significantdigitand most significant digit of adecimalinteger.

Bit indexing correlates to the positional notation of the value in base 2. For this reason, bit index is not affected by how the value is stored on the device, such as the value'sbyte order.Rather, it is a property of the numeric value in binary itself. This is often utilized in programming viabit shifting:A value of1 <<ncorresponds to thenthbit of a binary integer (with a value of2n).

Least significant bit in digital steganography

[edit]

In digitalsteganography,sensitive messages may be concealed by manipulating and storing information in the least significant bits of an image or a sound file. The user may later recover this information by extracting the least significant bits of the manipulated pixels to recover the original message. This allows the storage or transfer of digital information to remain concealed.

A diagram showing how manipulating the least significant bits of a color can have a very subtle and generally unnoticeable affect on the color. In this diagram, green is represented by itsRGBvalue, both in decimal and in binary. The red box surrounding the last two bits illustrates the least significant bits changed in the binary representation.

Unsigned integer example

[edit]

This table illustrates an example of decimal value of 149 and the location of LSb. In this particular example, the position of unit value (decimal 1 or 0) is located in bit position 0 (n = 0). MSb stands formost significant bit,while LSb stands forleast significant bit.

Binary (Decimal: 149) 1 0 0 1 0 1 0 1
Bit weight for given bit position n ( 2n) 27 26 25 24 23 22 21 20
Bit position label MSb LSb

Most- vs least-significant bit first

[edit]

The expressionsmost significant bit firstandleast significant bit at lastare indications on the ordering of the sequence of the bits in the bytes sent over a wire in aserial transmissionprotocol or in a stream (e.g. an audio stream).

Most significant bit firstmeans that the most significant bit will arrive first: hence e.g. the hexadecimal number0x12,00010010in binary representation, will arrive as the sequence0 0 0 1 0 0 1 0.

Least significant bit firstmeans that theleast significant bitwill arrive first: hence e.g. the same hexadecimal number0x12,again00010010in binary representation, will arrive as the (reversed) sequence0 1 0 0 1 0 0 0.

LSb 0 bit numbering

[edit]
LSb 0: A container for 8-bit binary number with the highlightedleast significant bitassigned the bit number 0

When the bit numbering starts at zero for theleast significant bit(LSb) the numbering scheme is calledLSb 0.[1]This bit numbering method has the advantage that for anyunsigned numberthe value of the number can be calculated by usingexponentiationwith the bit number and abaseof 2.[2]The value of an unsigned binaryintegeris therefore

wherebidenotes the value of the bit with numberi,andNdenotes the number of bits in total.

MSb 0 bit numbering

[edit]
MSb 0: A container for 8-bit binary number with the highlightedmost significant bitassigned the bit number 0

When the bit numbering starts at zero for themost significant bit(MSb) the numbering scheme is calledMSb 0.

The value of an unsigned binary integer is therefore

LSb calculation

[edit]

LSb of a number can be calculated with time complexity ofwith formula,wheremeansbitwise operationANDandmeansbitwise operationNOT on.

Other

[edit]

For MSb 1 numbering, the value of an unsigned binary integer is

PL/InumbersBITstrings starting with 1 for the leftmost bit.

TheFortranBTESTfunction uses LSb 0 numbering.

See also

[edit]

References

[edit]
  1. ^Langdon, Glen G. (1982).Computer Design.Computeach Press Inc. p.52.ISBN0-9607864-0-6.
  2. ^"Bit Numbers".Retrieved2021-03-30.