20 void fillarray(
void* p,
void* value,
size_t size,
size_t n ) {
23 char* cv = (
char*)value;
26 for(
unsigned int i = 0; i < n; i++ ) {
27 char* p_i = cp + ( size * i );
28 for(
unsigned int j = 0; j < size; j++ ) {
36 unsigned char zero = 0;
47 char* c = (
char*)#
60 if( p ==
NULL || n == 0 ) {
65 char* buffer =
new char[ n ];
68 memcpy( buffer, p, n );
72 for(
unsigned int i = 0; i < n; i++ ) {
73 cp[ i ] = buffer[ n - 1 - i ];
81 void memswap(
void* p0,
void* p1,
size_t n ) {
83 if( p0 ==
NULL || p1 ==
NULL || n == 0 ) {
88 void* tmp = malloc( n );
bool isbigendian()
judges whether the system is big endian
void fillarray(void *p, void *value, size_t size, size_t n)
This function assigns the specified value to each element.
void memswap(void *p0, void *p1, size_t n)
swaps memory ( p0 <-> p1 )
interfaces of function which deals with memory
bool islittleendian()
gets the system is little endian
void memreverse(void *p, size_t n)
reverse memory (ex. Big Endian <-> Little Endian)
void fillzero(void *p, size_t n)
This function fills a block of memory zeros.