#include <cstddef>
#include <cstring>
#include <algorithm>
#include "oct-cmplx.h"
#include "oct-inttypes.h"
Go to the source code of this file.
Defines | |
#define | DEFINE_POD_FILL(T) |
#define | DEFINE_POD_NEW_DELETE(T) |
#define | DEFINE_POD_UCOPY(T) |
Functions | |
template<class T > | |
void | copy_or_memcpy (size_t n, const T *src, T *dest) |
template<class T > | |
void | fill_or_memset (size_t n, const T &value, T *dest) |
template<class T > | |
bool | helper_is_zero_mem (const T &value) |
template<class T > | |
bool | helper_is_zero_mem (const std::complex< T > &value) |
template<class T > | |
bool | helper_is_zero_mem (const octave_int< T > &value) |
template<class T > | |
void | no_ctor_delete (T *ptr) |
template<class T > | |
T * | no_ctor_new (size_t n) |
size_t | safe_size_comp (size_t n, size_t size) |
#define DEFINE_POD_FILL | ( | T | ) |
inline void fill_or_memset (size_t n, const T& value, T *dest) \ { \ if (helper_is_zero_mem (value)) \ std::memset (dest, 0, n * sizeof (T)); \ else \ std::fill_n (dest, n, value); \ }
#define DEFINE_POD_NEW_DELETE | ( | T | ) |
template <> \ inline T *no_ctor_new<T > (size_t n) \ { return reinterpret_cast<T *> (new char[safe_size_comp (n, sizeof (T))]); } \ template <> \ inline void no_ctor_delete<T > (T *ptr) \ { delete [] reinterpret_cast<char *> (ptr); }
#define DEFINE_POD_UCOPY | ( | T | ) |
inline void copy_or_memcpy (size_t n, const T *src, T *dest) \ { std::memcpy (dest, src, n * sizeof (T)); }
void copy_or_memcpy | ( | size_t | n, | |
const T * | src, | |||
T * | dest | |||
) | [inline] |
Definition at line 49 of file oct-mem.h.
Referenced by SparseBoolMatrix::any(), Array< T >::ArrayRep::ArrayRep(), Sparse< T >::assign(), idx_vector::assign(), Sparse< T >::SparseRep::change_length(), idx_vector::copy_data(), Sparse< T >::delete_elements(), Array< T >::delete_elements(), rec_permute_helper::do_permute(), rec_resize_helper::do_resize_fill(), Sparse< T >::index(), idx_vector::index(), Sparse< T >::resize(), Array< T >::resize1(), Array< T >::resize2(), Sparse< bool >::Sparse(), Sparse< T >::SparseRep::SparseRep(), and SparseBoolMatrix::sum().
void fill_or_memset | ( | size_t | n, | |
const T & | value, | |||
T * | dest | |||
) | [inline] |
Definition at line 76 of file oct-mem.h.
Referenced by SparseBoolMatrix::any(), Array< T >::ArrayRep::ArrayRep(), Sparse< T >::delete_elements(), rec_resize_helper::do_resize_fill(), Array< T >::fill(), Sparse< T >::index(), Sparse< T >::resize(), Array< T >::resize1(), Array< T >::resize2(), and SparseBoolMatrix::sum().
bool helper_is_zero_mem | ( | const T & | value | ) | [inline] |
Definition at line 80 of file oct-mem.h.
Referenced by helper_is_zero_mem().
bool helper_is_zero_mem | ( | const std::complex< T > & | value | ) | [inline] |
Definition at line 87 of file oct-mem.h.
References helper_is_zero_mem().
bool helper_is_zero_mem | ( | const octave_int< T > & | value | ) | [inline] |
Definition at line 94 of file oct-mem.h.
References octave_int< T >::value().
void no_ctor_delete | ( | T * | ptr | ) | [inline] |
T* no_ctor_new | ( | size_t | n | ) | [inline] |
Definition at line 126 of file oct-mem.h.
References safe_size_comp().
size_t safe_size_comp | ( | size_t | n, | |
size_t | size | |||
) | [inline] |
Definition at line 39 of file oct-mem.h.
Referenced by no_ctor_new().