Click or drag to resize

HiByte Function

Return the high-order (leftmost) byte in a number.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION HiByte(
	wValue AS WORD
) AS BYTE
View Source

Parameters

wValue
Type: UInt16
The number whose high-order byte you want to get.

Return Value

Type: Byte
Remarks
Related data can be stored in the high-order and low-order words of a variable.  Therefore, instead of creating and returning a 2-element array, it may be more efficient to return a word whose 2 bytes contain separate information.
Examples
This example applies HiByte() and LoByte() to a binary number.  It also displays the high-order and low-order portions of the binary number as 2 separate numbers:
X#
bHi := HiByte(0b0000000011111111)
bLow := LoByte(0b0000000011111111)
// High-order bits
? 0b00000000                                                // 0
? bHi                                                        // 0
// Low-order bits
? 0b11111111                                                // 255
? bLow                                                        // 255
See Also