HIWORD
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgHiword
- 最后更新: 2022-11-04
获取操作数的第二个16位字。
语法
#define Hiword( expr ) ((Cast(Uinteger, expr) and &hFFFF0000) shr 16)用法
result = Hiword( expr )参数
expr
数值表达式,转换为 Uinteger 值。
返回值
返回 expr 低32位双字的高16位字值。
说明
该宏将数值表达式 expr 转换为 Uinteger 值,然后展开为表示其第二个16位字值的 Uinteger——即 expr 最低有效(低)32位双字的最高有效(高)16位字。
示例
start GeSHi
vb
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))
Sleepend GeSHi
输出结果如下:
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 新增
另请参阅
LobyteHibyteLoword
返回 目录