我有一些Python 3代码使用掩码从字节数组中提取信息,但是我需要在VB.NET程序中进行操作。这是Python。
modulation_indicies = ['Unknown','Normal','High','Low']
phs_noise = int.from_bytes(block_data[0x1E:0x20],byteorder='little') & 0x01FFF
mod_index = modulation_indicies[(int.from_bytes(block_data[0x1E:0x20],byteorder='little') & 0x0C000) >> 14]
其中block_data是字节数组。我的系统是little_endian。在VB.NET中如何编码?我已经尝试了来自不同论坛的几件事,但我无法理解。
Enum Modulation_indicies
Jumbo
ExtraLarge
Large
Medium
Small
End Enum
Sub Main()
phs_noise = BitConverter.ToInt32(you_write_this, 0) And &H1FFF
mod_index = Modulation_indicies(phs_noise And &HC000 >> 14)
End Sub