fixes from work:
- correct AllocateAligned deleter and alignment value - workaround for boost #pragma pack warnings add DivideRoundUp This was SVN commit r7439.
This commit is contained in:
parent
4c0d47707b
commit
b4f680594b
@ -66,14 +66,14 @@ struct AlignedDeleter
|
||||
template<class T>
|
||||
void operator()(T* t)
|
||||
{
|
||||
_mm_free(t);
|
||||
rtl_FreeAligned(t);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
shared_ptr<T> AllocateAligned(size_t size)
|
||||
{
|
||||
return shared_ptr<T>((T*)rtl_AllocateAligned(size, x86_x64_L1CacheLineSize()), AlignedDeleter());
|
||||
return shared_ptr<T>((T*)rtl_AllocateAligned(size, x86_x64_L2CacheLineSize()), AlignedDeleter());
|
||||
}
|
||||
|
||||
#endif // #ifndef INCLUDED_SHARED_PTR
|
||||
|
@ -218,6 +218,12 @@ STMT(\
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
template<typename T>
|
||||
T DivideRoundUp(T dividend, T divisor)
|
||||
{
|
||||
return (dividend + divisor-1) / divisor;
|
||||
}
|
||||
|
||||
/// 16-bit saturating (does not overflow) addition.
|
||||
extern u16 addusw(u16 x, u16 y);
|
||||
/// 16-bit saturating (does not underflow) subtraction.
|
||||
|
@ -105,6 +105,8 @@
|
||||
# define BOOST_ALL_DYN_LINK
|
||||
#endif
|
||||
|
||||
// work around Boost bug (missing #pragma pack(pop)?)
|
||||
#pragma pack(push, lib_precompiled)
|
||||
// the following boost libraries have been included in TR1 and are
|
||||
// thus deemed usable:
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -121,6 +123,7 @@ using boost::function;
|
||||
using boost::bind;
|
||||
#include "lib/external_libraries/boost_filesystem.h"
|
||||
#endif // !MINIMAL_PCH
|
||||
#pragma pack(pop, lib_precompiled)
|
||||
|
||||
// (this must come after boost and common lib headers)
|
||||
#include "lib/posix/posix.h"
|
||||
|
Loading…
Reference in New Issue
Block a user