Xojo.Core.MemoryBlock.LittleEndian
From Xojo Documentation
Property (As Boolean )
aXojo.Core.MemoryBlock.LittleEndian = newBooleanValue
or
BooleanValue = aXojo.Core.MemoryBlock.LittleEndian
Supported for all project types and targets.
or
BooleanValue = aXojo.Core.MemoryBlock.LittleEndian
Supported for all project types and targets.
When True, indicates that the MemoryBlock data is in LittleEndian format. The default is True.
Sample Code
Simple endian usage:
Var mb1 As New Xojo.Core.MemoryBlock(2) // defaults to Little Endian = True on all platforms
mb1.Int8Value(0) = 1
mb1.Int8Value(1) = 2
Var firstUInt16 As Int16
firstUInt16 = mb1.UInt16Value(0)
// firstUInt16 = (256 * 2) + (1 * 1) = 513
mb1.LittleEndian = False
Var secondUInt16 As Int16
secondUInt16 = mb1.UInt16Value(0)
// secondUInt16 = (256 * 1) + (1 * 2) = 258
mb1.Int8Value(0) = 1
mb1.Int8Value(1) = 2
Var firstUInt16 As Int16
firstUInt16 = mb1.UInt16Value(0)
// firstUInt16 = (256 * 2) + (1 * 1) = 513
mb1.LittleEndian = False
Var secondUInt16 As Int16
secondUInt16 = mb1.UInt16Value(0)
// secondUInt16 = (256 * 1) + (1 * 2) = 258