Skip to content

HIBYTE


获取操作数的第二个字节。

语法

#define Hibyte( expr ) ((Cast(Uinteger, expr) and &h0000FF00) shr 8)

用法

result = Hibyte( expr )

参数

expr

数值表达式,转换为 Uinteger 值。

返回值

返回 expr 低16位字的高字节值。

说明

该宏将数值表达式 expr 转换为 Uinteger 值,然后展开为表示其第二个字节值的 Uinteger——即 expr 最低有效(低)16位字的最高有效(高)字节。

示例

start GeSHi

vb
Dim N As UInteger

'Note there are 16 bits
N = &b1010101110000001
Print "N is                                       "; N
Print "The binary representation of N is          "; Bin(N)
Print "The most significant byte (MSB) of N is    "; HiByte(N)
Print "The least significant byte (LSB) of N is   "; LoByte(N)
Print "The binary representation of the MSB is    "; Bin(HiByte(N))
Print "The binary representation of the LSB is    "; Bin(LoByte(N))
Sleep

end GeSHi

输出结果如下:

N Is                                       43905
The Binary representation of N Is          1010101110000001
The most significant Byte (MSB) of N Is    171
The least significant Byte (LSB) of N Is   129
The Binary representation of the MSB Is    10101011
The Binary representation of the LSB Is    10000001

方言差异

  • -lang qb 方言中不可用,除非使用别名 __HIBYTE 引用。

与 QB 的差异

  • FreeBASIC 新增

另请参阅

  • Lobyte
  • Loword
  • Hiword

返回 目录

基于 FreeBASIC 官方文档翻译 如有侵权请联系我们删除
FreeBASIC 是开源项目,与微软公司无隶属关系