Geogram
Version 1.9.1
A programming library of geometric algorithms
|
Utilities for memory management. More...
Classes | |
struct | PointAlignment |
Defines the memory alignment of points in a vector. More... | |
struct | PointAlignment< 2 > |
PointAlignment specialization for points of dimension 2. More... | |
struct | PointAlignment< 3 > |
PointAlignment specialization for points of dimension 3. More... | |
struct | PointAlignment< 4 > |
PointAlignment specialization for points of dimension 4. More... | |
struct | PointAlignment< 6 > |
PointAlignment specialization for points of dimension 6. More... | |
struct | PointAlignment< 8 > |
PointAlignment specialization for points of dimension 8. More... | |
class | aligned_allocator |
An allocator that performs aligned memory allocations. More... | |
Typedefs | |
typedef unsigned char | byte |
Unsigned byte type. | |
typedef unsigned char | word8 |
Unsigned 8 bits integer. | |
typedef unsigned short | word16 |
Unsigned 16 bits integer. | |
typedef unsigned int | word32 |
Unsigned 32 bits integer. | |
typedef byte * | pointer |
Pointer to unsigned byte(s) | |
typedef void(* | function_pointer) () |
Generic function pointer. | |
Functions | |
void | clear (void *addr, size_t size) |
Clears a memory block. More... | |
void | copy (void *to, const void *from, size_t size) |
Copies a memory block. More... | |
pointer | function_pointer_to_generic_pointer (function_pointer fptr) |
Converts a function pointer to a generic pointer. More... | |
function_pointer | generic_pointer_to_function_pointer (pointer ptr) |
Converts a generic pointer to a function pointer. More... | |
function_pointer | generic_pointer_to_function_pointer (void *ptr) |
Converts a generic pointer to a function pointer. More... | |
void * | aligned_malloc (size_t size, size_t alignment=GEO_MEMORY_ALIGNMENT) |
Allocates aligned memory. More... | |
void | aligned_free (void *p) |
Deallocates aligned memory. More... | |
bool | is_aligned (void *p, size_t alignment=GEO_MEMORY_ALIGNMENT) |
Checks whether a pointer is aligned. More... | |
void * | align (void *p) |
Returns the smallest aligned memory address from p. | |
template<typename T1 , int A1, typename T2 , int A2> | |
bool | operator== (const aligned_allocator< T1, A1 > &, const aligned_allocator< T2, A2 > &) |
Tests whether two aligned_allocators are equal. More... | |
template<typename T1 , int A1, typename T2 , int A2> | |
bool | operator!= (const aligned_allocator< T1, A1 > &, const aligned_allocator< T2, A2 > &) |
Tests whether two aligned_allocators are different. More... | |
Utilities for memory management.
|
inline |
Deallocates aligned memory.
Deallocates the block of memory pointed to by p
. Note p
that must have been previously allocated by aligned_malloc()
|
inline |
Allocates aligned memory.
The address of the allocated block will be a multiple of alignment
. Aligned memory blocks are required by vector processing instructions (SSE, AVX...)
[in] | size | size of the block to allocate |
[in] | alignment | memory alignment (must be a power of 2) |
|
inline |
|
inline |
Copies a memory block.
Copies the first size
bytes of array from
to array to
. Note that this function has unpredictable results if the memory areas pointed to by to
and from
overlap.
[in] | to | the destination array of bytes |
[in] | from | the array of bytes to copy |
[in] | size | the number of bytes to copy |
|
inline |
Converts a function pointer to a generic pointer.
In C++ it is not legal to convert between function pointers and generic pointers using casts. Such conversion may be required when retrieving symbols in dynamically linked libraries, or when interfacing with scripting languages.
[in] | fptr | the function pointer |
fptr
|
inline |
Converts a generic pointer to a function pointer.
In C++ it is not legal to convert between function pointers and generic pointers using casts. Such conversion may be required when retrieving symbols in dynamically linked libraries, or when interfacing with scripting languages.
[in] | ptr | the generic pointer |
ptr
|
inline |
Converts a generic pointer to a function pointer.
In C++ it is not legal to convert between function pointers and generic pointers using casts. Such conversion may be required when retrieving symbols in dynamically linked libraries, or when interfacing with scripting languages.
[in] | ptr | the generic pointer |
ptr
|
inline |
|
inline |
Tests whether two aligned_allocators are different.
|
inline |
Tests whether two aligned_allocators are equal.