那么他们说的是,你需要comingle两个,像这样:
//for reference, this is 32 bits
123456789
000000000000000000000FirstValueA
000000000000000000000FirstValueB
它所要表达的是,我们需要将两者结合起来。它说A是低阶,B是高阶。
让我们参考维基百科的http://en.wikipedia.org/wiki/Least_significant_bit,看看low order is on the --> right
和high order is on the <-- left
。
low order -> right
high order <- left
A -> right
B <- left
因此,我们将与(我们上面的例子)
//for reference, this is 32 bits
123456789
000000000000000000000FirstValueA
000000000000000000000FirstValueB
成为
//for reference, this is 32 bits
123456789
000000000000000000000FirstValueB000000000000000000000FirstValueA
现在,如果值这个样子不行就结了:
//for reference, this is 32 bits
123456789
1001101100110100101011010001010100101000010110000101010011101010
//the above string of 1's and 0's is more correct for the example
你给的不是两个比纳ry字符串,但是有两个整数。所以你必须将左边的值乘以2 ** 32并将其加到正确的值。 (这是一个64位字段的方式)
让我们来看看寿,为什么低位在右边,而高位在左边:
二进制写入就像阿拉伯数字。在阿拉伯数字中,数字:
123456
表示一百二十三千四百五十六。十万是最重要的部分(因为我们将这个缩短为“超过10万美元”而不是“超过6美元”),而这六个部分是我们最自由放弃的部分。所以我们可以说这个数字是:
123是包含高阶比特的值,456是包含低阶比特的值。在这里,我们将通过10^3相乘,将它们添加到一起(这是一个数学的事实,而不是猜测,所以相信我这一点),因为它是这样的:
123
456
,并因此对于同样的作品二进制:
//for reference, this is 32 bits
123456789
000000000000000000000FirstValueB
000000000000000000000FirstValueA
TL; DR:
乘乙除以2^32,并添加到甲
1用于通过那些总低科技降价te显示器! – Josh 2012-01-09 21:21:43