Click or drag to resize

HiByte Function

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

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

Parameters

wValue
Type: Word
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#
1bHi := HiByte(0b0000000011111111)
2bLow := LoByte(0b0000000011111111)
3// High-order bits
4? 0b00000000                        // 0
5? bHi                            // 0
6// Low-order bits
7? 0b11111111                        // 255
8? bLow                            // 255
See Also