|
xoreos
0.0.5
|
Low-level macros and functions to handle different endianness portably. More...


Go to the source code of this file.
Macros | |
| #define | SWAP_CONSTANT_64(a) |
| #define | SWAP_CONSTANT_32(a) |
| #define | SWAP_CONSTANT_16(a) |
| #define | MKTAG(a0, a1, a2, a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) |
| A wrapper macro used around four character constants, like 'DATA', to ensure portability. More... | |
| #define | MKTAG_16(a0, a1) ((uint16)((a1) | ((a0) << 8))) |
| A wrapper macro used around two character constants, like 'MZ'. More... | |
Functions | |
| static uint64 | SWAP_BYTES_64 (uint64 a) |
| static uint32 | SWAP_BYTES_32 (uint32 a) |
| static uint16 | SWAP_BYTES_16 (const uint16 a) |
| FORCEINLINE uint16 | READ_UINT16 (const void *ptr) |
| FORCEINLINE uint32 | READ_UINT32 (const void *ptr) |
| FORCEINLINE uint64 | READ_UINT64 (const void *ptr) |
| FORCEINLINE void | WRITE_UINT16 (void *ptr, uint16 value) |
| FORCEINLINE void | WRITE_UINT32 (void *ptr, uint32 value) |
| FORCEINLINE void | WRITE_UINT64 (void *ptr, uint64 value) |
Low-level macros and functions to handle different endianness portably.
Definition in file endianness.h.
| #define MKTAG | ( | a0, | |
| a1, | |||
| a2, | |||
| a3 | |||
| ) | ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) |
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
Typical usage: MKTAG('D','A','T','A').
Why is this necessary? The C/C++ standard does not define the endianness to be used for character constants. Hence if one uses multi-byte character constants, a potential portability problem opens up.
Definition at line 140 of file endianness.h.
Referenced by Engines::KotOR::Walkmesh::appendFromStream(), Engines::Witcher::Area::Area(), Engines::NWN2::Area::Area(), Video::QuickTimeDecoder::AudioSampleDesc::createAudioStream(), Engines::NWN2::Campaign::getDescription(), Engines::Witcher::Campaign::getDescription(), Engines::NWN2::Module::getDescription(), Engines::Witcher::Module::getDescription(), Engines::NWN2::Campaign::getName(), Engines::Witcher::Campaign::getName(), Engines::NWN2::Module::getName(), Engines::Witcher::Module::getName(), Engines::Witcher::Area::getName(), Engines::NWN2::Area::getName(), Engines::KotOR2::Module::getName(), Engines::NWN::Area::getName(), Engines::KotOR::Module::getName(), Engines::KotOR::PartySelectionGUI::getPortrait(), Sound::WwRIFFVorbisStream::init(), Video::QuickTimeDecoder::VideoSampleDesc::initCodec(), Video::QuickTimeDecoder::initParseTable(), Video::QuickTimeDecoder::AudioSampleDesc::isAudioCodecSupported(), Engines::KotOR::Trigger::load(), Engines::KotOR2::Trigger::load(), Video::ActimagineDecoder::load(), Engines::Witcher::Creature::load(), Engines::KotOR::Waypoint::load(), Engines::KotOR2::Waypoint::load(), Engines::NWN::Waypoint::load(), Engines::NWN2::Waypoint::load(), Engines::Witcher::Waypoint::load(), Engines::NWN::GUI::load(), Engines::DragonAge2::Placeable::load(), Engines::DragonAge::Placeable::load(), Aurora::IFOFile::load(), Engines::Jade::Placeable::load(), Engines::Jade::Trigger::load(), Engines::Jade::Creature::load(), Engines::Witcher::Door::load(), Engines::NWN2::TRXFile::load(), Engines::Witcher::Placeable::load(), Engines::KotOR2::Placeable::load(), Engines::NWN2::Placeable::load(), Engines::KotOR::GUI::load(), Engines::Jade::GUI::load(), Sound::FMODSampleBank::load(), Engines::KotOR::Placeable::load(), Engines::Jade::Area::load(), Engines::NWN::Placeable::load(), Engines::NWN::Item::load(), Engines::KotOR::Door::load(), Sound::XACTWaveBank_Binary::load(), Engines::KotOR2::Door::load(), Engines::NWN2::Door::load(), Engines::NWN::Door::load(), Engines::KotOR2::Creature::load(), Video::XboxMediaVideo::load(), Engines::KotOR::Creature::load(), Engines::NWN2::Creature::load(), Engines::KotOR2::Area::load(), Engines::NWN::Area::load(), Engines::KotOR::Area::load(), Engines::NWN::Creature::load(), Engines::Witcher::Campaign::loadCampaignFile(), Engines::NWN2::Campaign::loadCampaignResource(), Common::PEResources::loadFromEXE(), Engines::Jade::Placeable::loadInstance(), Engines::NWN2::TRXFile::loadPacket(), Sound::SoundManager::makeAudioStream(), Sound::makeWAVStream(), Video::QuickTimeDecoder::QuickTimeAudioTrack::QuickTimeAudioTrack(), Video::QuickTimeDecoder::readDefault(), Video::QuickTimeDecoder::readHDLR(), Video::QuickTimeDecoder::readSampleDesc(), Aurora::SACFile::SACFile(), and Engines::KotOR::SoundObject::SoundObject().
| #define MKTAG_16 | ( | a0, | |
| a1 | |||
| ) | ((uint16)((a1) | ((a0) << 8))) |
A wrapper macro used around two character constants, like 'MZ'.
Definition at line 143 of file endianness.h.
Referenced by Common::PEResources::loadFromEXE().
| #define SWAP_CONSTANT_16 | ( | a | ) |
Definition at line 77 of file endianness.h.
| #define SWAP_CONSTANT_32 | ( | a | ) |
Definition at line 71 of file endianness.h.
| #define SWAP_CONSTANT_64 | ( | a | ) |
Definition at line 61 of file endianness.h.
| FORCEINLINE uint16 READ_UINT16 | ( | const void * | ptr | ) |
Definition at line 150 of file endianness.h.
| FORCEINLINE uint32 READ_UINT32 | ( | const void * | ptr | ) |
Definition at line 154 of file endianness.h.
| FORCEINLINE uint64 READ_UINT64 | ( | const void * | ptr | ) |
Definition at line 158 of file endianness.h.
Definition at line 128 of file endianness.h.
Definition at line 120 of file endianness.h.
Definition at line 108 of file endianness.h.
| FORCEINLINE void WRITE_UINT16 | ( | void * | ptr, |
| uint16 | value | ||
| ) |
Definition at line 162 of file endianness.h.
| FORCEINLINE void WRITE_UINT32 | ( | void * | ptr, |
| uint32 | value | ||
| ) |
Definition at line 166 of file endianness.h.
| FORCEINLINE void WRITE_UINT64 | ( | void * | ptr, |
| uint64 | value | ||
| ) |
Definition at line 170 of file endianness.h.
1.8.14