Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Memory library


Files

file  otMemory.h
 Memory Library.

Modules

 Version History

Functions

void * _memcpy (void *destination, const void *source, U32 num)
 Copy block of memory Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination. The underlying type of the objects pointed to by both the source and destination pointers are irrelevant for this function; The result is a binary copy of the data. The function does not check for any terminating null character in source - it always copies exactly num bytes. To avoid overflows, the size of the arrays pointed to by both the destination and source parameters, shall be at least num bytes, and should not overlap (for overlapping memory blocks, _memmove is a safer approach).
void * _memset (void *destination, int val, U32 num)
 Fill block of memory Sets the first num bytes of the block of memory pointed by destination to the specified value (interpreted as an unsigned char).
void * _memmove (void *destination, const void *source, U32 num)
 Move block of memory Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap. The underlying type of the objects pointed by both the source and destination pointers are irrelevant for this function; The result is a binary copy of the data. The function does not check for any terminating null character in source - it always copies exactly num bytes. To avoid overflows, the size of the arrays pointed by both the destination and source parameters, shall be at least num bytes.
int _memcmp (const void *ptr1, const void *ptr2, U32 num)
 Compare two blocks of memory Compares the first num bytes of the block of memory pointed by ptr1 to the first num bytes pointed by ptr2, returning zero if they all match or a value different from zero representing which is greater if they do not. Notice that, unlike _strcmp, the function does not stop comparing after finding a null character.

Function Documentation

int _memcmp const void *  ptr1,
const void *  ptr2,
U32  num
 

Parameters:
ptr1 Pointer to block of memory.
ptr2 Pointer to block of memory.
num Number of bytes to compare.
Returns:
Returns an integral value indicating the relationship between the content of the memory blocks:
<0 the first byte that does not match in both memory blocks has a lower value in ptr1 than in ptr2 (if evaluated as unsigned char values) 0 the contents of both memory blocks are equal >0 the first byte that does not match in both memory blocks has a greater value in ptr1 than in ptr2 (if evaluated as unsigned char values)

void* _memcpy void *  destination,
const void *  source,
U32  num
 

Parameters:
destination Pointer to the destination array where the content is to be copied, type-casted to a pointer of type void *.
source Pointer to the source of data to be copied, type-casted to a pointer of type const void *.
num Number of bytes to copy.
Returns:
destination is returned.

void* _memmove void *  destination,
const void *  source,
U32  num
 

Parameters:
destination Pointer to the destination array where the content is to be copied, type-casted to a pointer of type void*.
source Pointer to the source of data to be copied, type-casted to a pointer of type const void *.
num Number of bytes to copy.
Returns:
destination is returned.

void* _memset void *  destination,
int  val,
U32  num
 

Parameters:
destination Pointer to the block of memory to fill.
val Value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value.
num Number of bytes to be set to the value.
Returns:
destination is returned.
footer

otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0