HiWord, LoWord Functions

Purpose

Returns the high or low word in a Long expression.

Syntax

a& = HiWord(x%)

a& = LoWord(x%)

a&:16 bits integer
x%:32 bits integer expression

Description

HiWord() and LoWord() are used to return the higher and lower 16 bits of a value.

Example

Debug.Show

Dim a% = MakeLong(1234, 4321)

Trace HiWord(a%)

Trace TypeName(HiWord(a%))

Trace LoWord(a%)

Trace TypeName(LoWord(a%))

Trace Word(a%)

Remarks

a% = HiWord(x%) is identical to a% = Word(Shr(x%,16)), but the second expression is compatible with the MS-DOS version of GFA-BASIC.

LoWord Word SWord Short: These functions are the same and load the value into the eax register and performs a CDWE assembler instruction to extend the lower 16 bits to the upper 16 bits.

See Also

HiByte(), HiCard(), HiLarge(), LoByte(), LoCard(), LoLarge()

{Created by Sjouke Hamstra; Last updated: 09/10/2014 by James Gaite}