The GetByte functions read a byte from a 32-bits value.
Byte = GetByte0(value)
Byte = GetByte1(value)
Byte = GetByte2(value)
Byte = GetByte3(value)
value:aexp of 4-bytes
GetByte0 reads the first byte (MSB - most significant byte) of a value of a 32-bits data type.
GetByte1 reads the second byte of a value (2nd MSB).
GetByte2 reads the third byte of a value (3rd MSB).
GetByte3 reads the fourth byte of a value (LSB - least significant byte).
Dim a% = $01020304
Debug.Show
Trace GetByte0(a%) ' 1
Trace GetByte1(a%) ' 2
Trace GetByte2(a%) ' 3
Trace GetByte3(a%) ' 4
Example 1
OpenW 1
Local a As Single, byte0%, byte1%, x%
Local byte2%, byte3%
a = 222266 * 456 + 97 * 35786
byte0% = GetByte0(a)
byte1% = GetByte1(a)
byte2% = GetByte2(a)
byte3% = GetByte3(a)
Print a, byte0%, byte1%, byte2%, byte3%
Example 2
OpenW 1
Local byte_hi0%, byte_hi1%, byte_hi2%, x%
Local byte_hi3%, byte2%, byte3%, a_int%
Local a As Large, byte0%, byte1%
a = _maxLarge
a_int% = HiLarge( a)
byte0% = GetByte0(a)
byte1% = GetByte1(a)
byte2% = GetByte2(a)
byte3% = GetByte3(a)
Print a, byte0%, byte1%, byte2%, byte3%
byte_hi0% = GetByte0(a_int%)
byte_hi1% = GetByte1(a_int%)
byte_hi2% = GetByte2(a_int%)
byte_hi3% = GetByte3(a_int%)
Print a_int%, byte_hi0%, byte_hi1%, byte_hi2%, byte_hi3%
Print Hex$(a)
GetBValue, GetGValue, GetRValue
{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}