Citizendia

In computing, the most significant bit (msb) is the bit position in a binary number having the greatest value. Computing is usually defined like the activity of using and developing Computer technology Computer hardware and software. A bit is a binary digit, taking a value of either 0 or 1 Binary digits are a basic unit of Information storage and communication The binary numeral system, or base-2 number system, is a Numeral system that represents numeric values using two symbols usually 0 and 1. The msb is sometimes referred to as the left-most bit, due to the convention in positional notation of writing more significant digits further to the left. A positional notation or place-value notation system is a Numeral system in which each position is related to the next by a Constant multiplier a

The msb can also correspond to the sign of a signed binary number in one or two's complement notation. In Computer science, the sign bit is a Bit (usually the Most significant bit) in a Computer numbering format that indicates the sign "1" meaning negative and "0" meaning positive.

MSB, in all capitals, can also stand for "most significant byte". The meaning is parallel to the above: it is the byte (or octet) in that position of a multi-byte number which has the greatest potential value. In Computing, an octet is a grouping of eight Bits Octet, with the only exception noted below always refers to an entity having exactly eight

By extension, the most significant bits (plural) are the bits of the number closest to, and including, the msb.

The unsigned binary representation of decimal 149, with the msb highlighted.  The msb in an 8-bit binary number represents a value of 128 decimal.  The lsb represents a value of 1.
The unsigned binary representation of decimal 149, with the msb highlighted. The binary numeral system, or base-2 number system, is a Numeral system that represents numeric values using two symbols usually 0 and 1. The msb in an 8-bit binary number represents a value of 128 decimal. The lsb represents a value of 1.

Contents

Conventions

In referencing specific bits within a binary number, it is common to assign each bit a bit number, ranging from zero upwards to one less than the number of bits in the number. However, the order used for this assignment may be in either direction, and both orderings are used (in different contexts). This is one reason why "msb" is often used to designate the high-order bit instead of a bit number (which has greater potential for confusion).

Transmission

With 802.5 and FDDI, the most significant bit is transmitted first. Token ring Local area network (LAN technology is a local area network protocol which resides at the Data link layer Fiber distributed data interface ( FDDI) provides a standard for Data transmission in a Local area network [1]

Computing position of most significant 1 bit of an integer

The following code example for the C language is an algorithm to compute the position of most significant 1 bit of a 32 bit integer. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured [1] Operator '>>' represents 'unsigned right shift'.

/** * Returns the most significant bit position of n from 0 to 31.  * -1 is returned if n is 0.  */int mostSignificantBitPosition(unsigned int n) {  int pos = 0;  int tmp;  tmp = n >> 16;  if (tmp != 0) { n = tmp; pos = pos + 16; }  tmp = n >> 8;  if (tmp != 0) { n = tmp; pos = pos + 8; }  tmp = n >> 4;  if (tmp != 0) { n = tmp; pos = pos + 4; }  tmp = n >> 2;  if (tmp != 0) { n = tmp; pos = pos + 2; }  tmp = n >> 1;  if (tmp != 0) { n = tmp; pos = pos + 1; }  return pos + n - 1;}
// C# code to return the index of the MSB.   MSB(0)=0public static int MostSignificantBit (UInt32 n)                            {     int b = 0;     if (0 != (n & (~0u << (1 << 4)))) { b |= (1 << 4); n >>= (1 << 4); }     if (0 != (n & (~0u << (1 << 3)))) { b |= (1 << 3); n >>= (1 << 3); }     if (0 != (n & (~0u << (1 << 2)))) { b |= (1 << 2); n >>= (1 << 2); }     if (0 != (n & (~0u << (1 << 1)))) { b |= (1 << 1); n >>= (1 << 1); }     if (0 != (n & (~0u << (1 << 0)))) { b |= (1 << 0); }     return b;}
// C# code to return the index of the MSB.   MSB(0)=0public static int MostSignificantBit(UInt64 n){     int b = 0;     if (0 != (n & (~0uL << (1 << 5)))) { b |= (1 << 5); n >>= (1 << 5); }     if (0 != (n & (~0uL << (1 << 4)))) { b |= (1 << 4); n >>= (1 << 4); }     if (0 != (n & (~0uL << (1 << 3)))) { b |= (1 << 3); n >>= (1 << 3); }     if (0 != (n & (~0uL << (1 << 2)))) { b |= (1 << 2); n >>= (1 << 2); }     if (0 != (n & (~0uL << (1 << 1)))) { b |= (1 << 1); n >>= (1 << 1); }     if (0 != (n & (~0uL << (1 << 0)))) { b |= (1 << 0); }     return b;}

For interpreted languages, the log2 function is generally faster and more succinct to use. The following example expresses this method using Python.

from math import logdef msb_pos(n):    return int(log(n, 2))

Since Java 1. 5, the Java standard library provides the Integer.numberOfLeadingZeros(int) and Long.numberOfLeadingZeros(long) methods to compute the number of leading zeros in 32-bit and 64-bit integers, respectively. This number is equal to (the width of the integer) - 1 - (the position of the most significant 1 bit).

References

  1. ^ Warren Jr. , Henry S. (2002), Hacker's Delight, Addison Wesley, pp. pp. 77, ISBN 978-0201914658 

See also

In Computing, the least significant bit ( lsb) is the Bit position in a binary Integer giving the units value that is determining The binary numeral system, or base-2 number system, is a Numeral system that represents numeric values using two symbols usually 0 and 1. In Mathematics, negative numbers in any base are represented in the usual way by prefixing them with a "&minus" sign The two's complement of a Binary number is defined as the value obtained by subtracting the number from a large power of two (specifically from 2 N for In Computing, Bit positions in a binary number or a container for such a value are assigned a bit number

Dictionary

most significant bit

-noun

  1. (computing) The bit that represents the largest fraction of a value, its position depending on the endianness of the system.
© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic