我想知道是否有可能获得数字的最低有效位。
例:
uint intValue = Int32.MaxValue;
uint LSB = intValue & 0x0000FFFF;
从:
https://www.oreilly.com/library/view/c-cookbook/0596003390/ch01s06.html
但我 VB.net 需要这个。
我试过了:
Dim intValue As UInteger = 39101
Dim LSB As UInteger = intValue And &HFFFF
知道吗?
这应该可以帮助您可视化正在发生的事情。 它显示了各种面具。 查看每个站点的"位"。
Dim bits As String
Dim intValue As UInteger = 39101
Dim LSB As UInteger
bits = Convert.ToString(intValue, 2).PadLeft(32, "0"c)
Stop
LSB = intValue And &HFFFFUI 'keep 16 bits
bits = Convert.ToString(LSB, 2).PadLeft(32, "0"c)
Stop
LSB = intValue And &HFFUI 'keep 8 bits
bits = Convert.ToString(LSB, 2).PadLeft(32, "0"c)
Stop
LSB = intValue And &HFUI 'keep 4 bits
bits = Convert.ToString(LSB, 2).PadLeft(32, "0"c)