VB.NET位操作:如何从短中提取字节? [英] VB.NET Bit manipulation: how to extract byte from short?
本文介绍了VB.NET位操作:如何从短中提取字节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于这种短(签字):
&Hxxxx
我想:
- 提取最右边的
&放大器; HxxFF
作为为SByte(签字) - 提取左
&放大器; H7Fxx
为字节(无符号) - 确定是否最左边
&放大器; H8xxx
是正还是负(布尔结果)
- Extract the most right
&HxxFF
as SByte (signed) - Extract the left
&H7Fxx
as Byte (unsigned) - Identify if the most left
&H8xxx
is positive or negative (bool result)
推荐答案
呃......
value & 0x00ff
(value & 0xff00) >> 8
(value & 0xf000) >= 0
编辑:我想你想的字节值,而不仅仅是高8位
I suppose you want the byte value and not just the upper 8 bits.
这篇关于VB.NET位操作:如何从短中提取字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文