1.比特序
/ 位序 / bit numbering
/
我们知道一个字节有8位,也就是8个比特位。从第0位到第7位共8位。比特序就是用来描述比特位在字节中的存放顺序的。通过阅读网页的内容,关于比特序我们得到下面的结论:
(1)比特序分为两种:LSB
0位序和MSB
0位序。
LSB
0位序是指:字节的第0位存放数据的,即我们的数据的最低位存放在字节的第0位。
MSB
0位序是指:字节的第0位存放,即我们的数据的最高位存放在字节的第0位。
所以说对于代码:char *ch = 0x96;
// 0x96 = 1001 0110
指针ch到底指向哪里呢?不难知道,如果是LSB
0位序则显然指针ch指向最右边的也是最低位的0.
而如果是MSB
0位序则显然指针ch指向最左边的也是最高位的1.
LSB 0: A container for
8-bit binary number with the highlighted least significant bit assigned the
bit number 0
MSB 0:A container for 8-bit
binary number with the highlighted most significant bit assigned the bit
number 0
(2)小端CPU通常采用的是LSB
0位序,但是大端CPU却有可能采用LSB
0位序也有可能采用的是MSB
0位序
(Little-endian CPUs usually employ
"LSB 0" bit numbering, however both bit numbering conventions can
be seen in big-endianmachines. )
(3)推荐的标准是MSB
0位序。
(The
recommended style for Request for Comments documents is
"MSB 0" bit numbering.)
(4)Bit
numbering is usually transparent to the
In computing, the
term endian or endianness refers
to the ordering of individually addressable sub-components within
the representation of a larger data item as stored
in external memory (or,
sometimes, as sent on a serial connection). Each sub-component in
the representation has a unique degree of significance, like
the place
value of digits in a decimal number. These
sub-components are typically 16- or
32-bit words, 8-bit bytes, or
even bits.
Endianness is a difference in data representation at the hardware
level and may or may not be transparent at higher levels, depending
on factors such as the type of high level language used.
计算机中,术语“端”是指:在内存中的一个较大的数据,它是由各个可以被单