| M E M _ A C C E S S A R R A Y ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English PORTA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_accessarray() - Access cell based array element.
SYNOPSIS
addr = mem_accessarray(ptr, size, node);
ULONG mem_accessarray(ULONG *, ULONG, ULONG);
FUNCTION
This function allows to access particular element in
the array both for reading and writing.
INPUTS
ptr - Array address.
size - Size of one element.
node - Element(index) to access.
RETURNS
Returns addr. as an integer that should be typecasted
to the word size spcified in 'size'.
BASES
SysBase
NOTES
None.
SEE ALSO
mem_allocarray(), mem_freearray()
EXAMPLE
...
void *array;
/*
* Create an array as big as 524288 elements, where
* each element is 4 bytes wide. It is something like
* you would declare 'ULONG array[524288]' but wont
* of course require large continous memory block.
*/
if ((array = mem_allocarray(4096,
sizeof(ULONG), 524288, MEMF_PUBLIC)))
{
/*
* Write something to element 123456.
*/
(*(ULONG *)mem_accessarray(
array, sizeof(ULONG), 123456)) = 0xFEEDF00D;
...
mem_freearray(array);
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |