48 #if defined(_MSC_VER) && (_MSC_VER>=1400)
50 # define mrpt_alloca( nBytes ) _malloca(nBytes)
51 #elif defined(HAVE_ALLOCA)
53 # define mrpt_alloca( nBytes ) ::alloca(nBytes)
56 # define mrpt_alloca( nBytes ) ::malloc( nBytes )
63 #if defined(_MSC_VER) && (_MSC_VER>=1400)
65 # define mrpt_alloca_free( mem_block ) _freea(mem_block)
66 #elif defined(HAVE_ALLOCA)
68 # define mrpt_alloca_free( mem_block )
71 # define mrpt_alloca_free( mem_block ) free(mem_block)
92 if (ptr) ::memset(ptr,0,bytes);
111 template<
typename _Tp>
inline _Tp*
align_ptr(_Tp* ptr,
int n=(
int)
sizeof(_Tp))
113 return (_Tp*)(((size_t)ptr + n-1) & -n);
123 template<
int bytes>
bool is_aligned(
const void* ptr);
124 template<>
inline bool is_aligned<8>(
const void* ptr) {
return ((reinterpret_cast<size_t>(ptr)) & 0x7) == 0; }
125 template<>
inline bool is_aligned<16>(
const void* ptr) {
return ((reinterpret_cast<size_t>(ptr)) & 0xF) == 0; }