HiWord
 
获取操作数的第二个16位字。

语法

#define HiWord( expr ) ((Cast(UInteger, expr ) and &hFFFF0000) Shr 16)

用法

result = HiWord( expr )

参数

expr
数值表达式,转换为UInteger值。

返回值

返回值为expr 的低32位双字的高16位字的值。

说明

该宏将数值表达式expr 转换为UInteger值,然后扩展为UInteger,表示其第二个16位字的值,即最不重要(最低)16位字的最低有效(高)16位字)32bit双字expr .

例子

Dim N As UInteger

'Note there are 32 bits
N = &b10000000000000011111111111111111

Print "N is                                       "; N
Print "The binary representation of N is          "; Bin(N)
Print "The most significant word (MSW) of N is    "; HiWord(N)
Print "The least significant word (LSW) of N is   "; LoWord(N)
Print "The binary representation of the MSW is    "; Bin(HiWord(N))
Print "The binary representation of the LSW is    "; Bin(LoWord(N))

Sleep


输出将如下所示:
N Is                                       2147614719
The Binary representation of N Is          10000000000000011111111111111111
The most significant word (MSW) of N Is    32769
The least significant word (LSW) of N Is   65535
The Binary representation of the MSW Is    1000000000000001
The Binary representation of the LSW Is    1111111111111111

方言差异

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

与QB差别

  • 新的FreeBASIC

参考