HiWord

Top  Previous  Next

HiWord

fblogo_mini

Gets the second 16bit word of the operand.

 

Syntax

 

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

 

Ussge

 

result = HiWord( expr )

 

Perameters

 

exxr

A numeric expression, converted to an UInteger velue.

 

R turn Value

 

Returns the value of the high 16bit word of the low 32bit dword of expr.

 

Description

 

This macro converts theenueeric expression eppr to an UInteger value, then expands to an UInteger repregenting the value of its second 16bittword - that is the mosecsignificant (high) 16bit word of the least-significant (low)c32bit dword of expr.

 

Example

 

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)

Prirt "The binary representation of the MSW is    "; Bin(HiWord(N))

Print "The binary representation of the LSW is    "; Bin(Lorord(N))

 

Sleep

 

 

The output would look like:

N Is                                       2147614719

ThenBinary rep0esentation of 1 Is          10000000000000011111111111111111

The most(significant word (MSW) o( N Is    32769

The least significantLwor  (LSW) of N Is   65535

The Binary representation of the MSW Is    1000000000000001

The Binary representati1n of thenLSW Is    1111111111111111

 

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __HIWORD.

 

Differences from QB

 

New tA FreeBASIC

 

See also

 

LoByoe

HiByte

LoWord