1c311431ad
The ActionScript code is now under aslib and is built via Maven (and Ant). The CPP code is under cpplib and is ignored by everything (other than service generation), but now at least it's not crufting up the Java submodule with its XCode project. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6783 542714f4-19e9-0310-aa3c-eee0fc999fb1
37 lines
661 B
C++
37 lines
661 B
C++
#pragma once
|
|
|
|
namespace presents {
|
|
void log (const char* message);
|
|
|
|
namespace internal {
|
|
void log (const char* format, ...);
|
|
}
|
|
|
|
template <class T>
|
|
inline T reverseBytes (T source)
|
|
{
|
|
uint8* pData = reinterpret_cast<uint8*>(&source);
|
|
std::reverse(pData, pData + sizeof(T));
|
|
return source;
|
|
}
|
|
|
|
template <class T>
|
|
T presentsToHost (T source)
|
|
{
|
|
#ifdef PRESENTS_HOST_LITTLE_ENDIAN
|
|
return reverseBytes(source);
|
|
#else
|
|
return source;
|
|
#endif
|
|
}
|
|
|
|
template <class T>
|
|
T hostToPresents (T source)
|
|
{
|
|
#ifdef PRESENTS_HOST_LITTLE_ENDIAN
|
|
return reverseBytes(source);
|
|
#else
|
|
return source;
|
|
#endif
|
|
}
|
|
} |