Functions

Arrays allocated as One Dimensional (1D) Array Objects

Arrays for arbitrary dimensions. Done by constructing 1D arrays. Handles memory alignment also. More...

Functions

NTTW_DLL_SYM void array (void **pointer, const size_t nbytes)
 Forms an array of size.
NTTW_DLL_SYM nttw_integerarray_1D (const size_t size)
 Forms an 1D array of size.
NTTW_DLL_SYM long * arraySigned_1D (const size_t size)
 Forms an 1D signed array of size.
NTTW_DLL_SYM unsigned char * arrayUChar_1D (const size_t size)
 Forms an 1D unsigned character array of size.
NTTW_DLL_SYM nttw_big_integerarray_1D_big (const size_t size)
 Forms an 1D array of size.
NTTW_DLL_SYM void init_1D (nttw_integer *data, const size_t size, const nttw_integer value)
NTTW_DLL_SYM void initSigned_1D (long *data, const size_t size, const long value)
NTTW_DLL_SYM void initUChar_1D (unsigned char *data, const size_t size, const unsigned char value)
NTTW_DLL_SYM void init_1D_big (nttw_big_integer *data, const size_t size, const nttw_big_integer value)
NTTW_DLL_SYM void free_array (void *pointer)

Detailed Description

Arrays for arbitrary dimensions. Done by constructing 1D arrays. Handles memory alignment also.

The main function is array_1D() and free array by using free_array(). These functions handle memory alignment independently of platform.

Todo:
Add memory alignment code.

Function Documentation

array ( void **  pointer,
const size_t  nbytes 
)

Forms an array of size.

Parameters:
pointer Pointer to the array to be allocated. It's a Double pointer because it is passed by reference.
nbytes The bytes to be allocated. Use the sizeof() function here.

Constructs a array for 1D reference. Reference into array as j*columns+k, where j is the current row and k the current column. The malloc function is used to allocate the memory and garbage collection is NOT automated, please use free_array() to deallocate the memory.

Definition at line 28 of file array.c.

array_1D ( const size_t  size  ) 

Forms an 1D array of size.

Returns:
Pointer to the first element of the array.

Constructs a 1-dimensional array of type nttw_integer (defined in global.h). Allocates 16-bit integers in 32-bit mode or 32-bit integers in 64-bit mode. The malloc function is used to allocate the memory and garbage collection is NOT automated, please use free_array() to deallocate the memory.

Definition at line 39 of file array.c.

array_1D_big ( const size_t  size  ) 

Forms an 1D array of size.

Returns:
Pointer to the first element of the array.

Constructs a 1-dimensional array of type nttw_integer (defined in global.h). Allocats 32-bit integers in 32-bit mode or 64-bit integers in 64-bit mode. The malloc function is used to allocate the memory and garbage collection is NOT automated, please use free_array() to deallocate the memory.

Definition at line 84 of file array.c.

arraySigned_1D ( const size_t  size  ) 

Forms an 1D signed array of size.

Returns:
Pointer to the first element of the array.

Constructs a 1-dimensional array of type long. Allocates signed integers of maximum machine word size. The malloc function is used to allocate the memory and garbage collection is NOT automated, please use free_array() to deallocate the memory.

Definition at line 54 of file array.c.

arrayUChar_1D ( const size_t  size  ) 

Forms an 1D unsigned character array of size.

Returns:
Pointer to the first element of the array.

Constructs a 1-dimensional array of type unsigned char. The malloc function is used to allocate the memory and garbage collection is NOT automated, please use free_array() to deallocate the memory.

Definition at line 69 of file array.c.

free_array ( void *  pointer  ) 

Frees the Byte Aligned array allocated by array() or array_1D() correctly.

Definition at line 131 of file array.c.

init_1D ( nttw_integer data,
const size_t  size,
const nttw_integer  value 
)

Initializes the 1D array to value provided.

Definition at line 99 of file array.c.

init_1D_big ( nttw_big_integer data,
const size_t  size,
const nttw_big_integer  value 
)

Initializes the 1D array to value provided.

Definition at line 123 of file array.c.

initSigned_1D ( long *  data,
const size_t  size,
const long  value 
)

Initializes a signed 1D array to value provided.

Definition at line 107 of file array.c.

initUChar_1D ( unsigned char *  data,
const size_t  size,
const unsigned char  value 
)

Initializes a unsigned character 1D array to value provided.

Definition at line 115 of file array.c.