mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-03 17:37:18 +00:00
9ae077c033
* use c++11 std::align from <memory> * for Ubuntu, use gcc5 instead of 4.8 * use travis to set gcc to 5 eval and sudo * use eval in .travis.yml * use gcc-8 * replace precise with trusty llvm toolchain, because we have been using trusty for awhile now * push things to matrix, so we can support multiple releases if we want * we should not be allowing for failures, we are ready to start trusting clang and its analyzer * scan-build was pushed to another package * use gcc-8 still but wrap in scan-build * travis.yml cleanup, have output of scripts go to stdout, make search for substring a regex use double [] fix missing , use bash to use regex black spaces matter * set human readable names for our various builds, split out our static analysis between openmw and openmw-cs * test if not set, then set otherwise ignore * use quotes * do not eval it, set it in travis env * no more && * what does clang7 have to say? * use sourceline for now * use clang-7 instead of clang-7.0 * yes, llvm-toolchain-trusty-7 not llvm-toolchain-trusty-7.0 * for static analysis, openmw is compiled and checked on its own while openmw-cs is build with all the rest. this might change in the future. and actually do it the other way around
92 lines
2.0 KiB
C++
92 lines
2.0 KiB
C++
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTALLOCUTILS_H
|
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_RECASTALLOCUTILS_H
|
|
|
|
#include <RecastAlloc.h>
|
|
|
|
#include <cstdint>
|
|
|
|
namespace DetourNavigator
|
|
{
|
|
static_assert(sizeof(std::size_t) == sizeof(void*), "");
|
|
|
|
enum BufferType : std::size_t
|
|
{
|
|
BufferType_perm,
|
|
BufferType_temp,
|
|
BufferType_unused,
|
|
};
|
|
|
|
inline BufferType* tempPtrBufferType(void* ptr)
|
|
{
|
|
return reinterpret_cast<BufferType*>(static_cast<std::size_t*>(ptr) + 1);
|
|
}
|
|
|
|
inline BufferType getTempPtrBufferType(void* ptr)
|
|
{
|
|
return *tempPtrBufferType(ptr);
|
|
}
|
|
|
|
inline void setTempPtrBufferType(void* ptr, BufferType value)
|
|
{
|
|
*tempPtrBufferType(ptr) = value;
|
|
}
|
|
|
|
inline void** tempPtrPrev(void* ptr)
|
|
{
|
|
return static_cast<void**>(ptr);
|
|
}
|
|
|
|
inline void* getTempPtrPrev(void* ptr)
|
|
{
|
|
return *tempPtrPrev(ptr);
|
|
}
|
|
|
|
inline void setTempPtrPrev(void* ptr, void* value)
|
|
{
|
|
*tempPtrPrev(ptr) = value;
|
|
}
|
|
|
|
inline void* getTempPtrDataPtr(void* ptr)
|
|
{
|
|
return reinterpret_cast<void*>(static_cast<std::size_t*>(ptr) + 2);
|
|
}
|
|
|
|
inline BufferType* dataPtrBufferType(void* dataPtr)
|
|
{
|
|
return reinterpret_cast<BufferType*>(static_cast<std::size_t*>(dataPtr) - 1);
|
|
}
|
|
|
|
inline BufferType getDataPtrBufferType(void* dataPtr)
|
|
{
|
|
return *dataPtrBufferType(dataPtr);
|
|
}
|
|
|
|
inline void setDataPtrBufferType(void* dataPtr, BufferType value)
|
|
{
|
|
*dataPtrBufferType(dataPtr) = value;
|
|
}
|
|
|
|
inline void* getTempDataPtrStackPtr(void* dataPtr)
|
|
{
|
|
return static_cast<std::size_t*>(dataPtr) - 2;
|
|
}
|
|
|
|
inline void* getPermDataPtrHeapPtr(void* dataPtr)
|
|
{
|
|
return static_cast<std::size_t*>(dataPtr) - 1;
|
|
}
|
|
|
|
inline void setPermPtrBufferType(void* ptr, BufferType value)
|
|
{
|
|
*static_cast<BufferType*>(ptr) = value;
|
|
}
|
|
|
|
inline void* getPermPtrDataPtr(void* ptr)
|
|
{
|
|
return static_cast<std::size_t*>(ptr) + 1;
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|