Talk:Least significant bit
"In computing, the least significant bit (LSB) is the bit position in a binary number having the value of 1."
- Not for a floating point number. Right? - Omegatron 19:01, Jan 27, 2005 (UTC)
- Correct. Would the following be a better wording? "In computing, the least significant bit (LSB) is the bit position in a binary number having the integer value of 1." Would it be appropriate to mention floating point here? Or would that be too much of a diversion from the topic? Jimwilliams57 02:34, Jan 28, 2005 (UTC)
Is the LSB transmitted first or the MSB? For instance, to transmit the decimal number 1, transmission could be either:
LSB first --> 10000000 --> High-Low-Low-Low-Low-Low-Low-Low
MSB first --> 00000001 --> Low-Low-Low-Low-Low-Low-Low-High Anwar (talk) 22:16, 20 May 2008 (UTC)
- This question is related to Endianness. Network enddianness is usually big-endian, or MSB first. C xong (talk) 06:01, 2 March 2010 (UTC)
If Else Implementation
I don't know why would someone post the current implement with 7 if statements. You can easily implement a one-liner with
n & ~(n - 1) for unsigned types.
It is commonly known that
n & (n - 1) remove the least significant bit in an unsigned type. Using this, you can logically proof the one-liner I presented.
leastbit = n & ~(n & (n - 1)); // bring the ~ into the parenthesis. (Distributivity) leastbit = n & (~n | ~(n - 1)); // distribute n into the parenthesis. (Distributivity) leastbit = (n & ~n) | (n & ~(n - 1)); // n & ~n cancel out leastbit = 0 | (n & ~(n - 1)); // ORing zero does nothing so it can be removed leastbit = n & ~(n - 1);
LSB or lsb ?
LSB (all capitals) is generally used to indicate least significant bit in many fields (such as data converters).
The acronym LSB, with the meaning of least significant bit, is defined in the authoritative IEC 60050 Electrotechnical Vocabulary (IEV number 723-10-12, ). This article, instead, encourages implicitly the use of lsb (and not LSB) to indicate least significant bit. This is wrong. Somewhere (such as ) the use of LSB with the meaning of least significant byte is indicated as rare.
The distinction between lsb and LSB made in this article in sensible. However, as a matter of fact, LSB is used with two different meanings, and this should be reflected clearly in the paper. --Adnadn (talk) 20:09, 2 October 2009 (UTC)