SophiaFramework UNIVERSE 5.3 |
SFXEndian is the class for converting the endian.
Example 20.34. How to use the SFXEndian class
UInt08 n1 = 0xAB; // swap upper 4 bits with lower 4 bits n1 = SFXEndian::NibbleSwapU08(n1); // n1 = 0xBA UInt32 n2 = 0x12345678; // convert endian n2 = SFXEndian::EndianSwapU32(n2); // n2 = 0x78563412 Byte table[4]; // write value of UInt32 type to memory as big endian SFXEndian::SetPToBU32(table, n2); // table = {0x78, 0x56, 0x34, 0x12} table[0] = 0x12; table[1] = 0x34; table[2] = 0x56; table[3] = 0x78; // read value of UInt32 type from memory as big endian UInt32 n3 = SFXEndian::GetBToPU32(table); // n3 = 0x12345678 // read value of UInt32 type from memory as little endian UInt32 n4 = SFXEndian::GetLToPU32(table); // n4 = 0x78563412
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |