|
|
/* $Id$ */
|
|
|
|
|
|
/** @file helpers.hpp */
|
|
|
|
|
|
#ifndef HELPERS_HPP
|
|
|
#define HELPERS_HPP
|
|
|
|
|
|
/** @file helpers.hpp */
|
|
|
#include "macros.h"
|
|
|
|
|
|
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
|
|
|
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
|
|
|
template <typename T> FORCEINLINE T* MallocT(size_t num_elements)
|
|
|
{
|
|
|
T *t_ptr = (T*)malloc(num_elements * sizeof(T));
|
|
|
return t_ptr;
|
|
|
}
|
|
|
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
|
|
|
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
|
|
|
template <typename T> FORCEINLINE T* CallocT(size_t num_elements)
|