These are utilities for OS-independent memory manipulation such as filling and copying.
More...
Functions |
void | OSAPI_Memory_copy (void *dest, const void *src, RTI_SIZE_T size) |
| Copies size bytes from non-overlapping src to dest.
|
void | OSAPI_Memory_zero (void *mem, int size) |
| Sets memory region to 0.
|
RTI_INT32 | OSAPI_Memory_compare (const void *left, const void *right, RTI_SIZE_T size) |
| Byte-wise compare of two memory regions.
|
void | OSAPI_Memory_move (void *dest, const void *source, RTI_SIZE_T size) |
| Moves size bytes from non-overlapping src to dest.
|
void * | OSAPI_Memory_fndchr (const void *s, RTI_INT32 c, RTI_SIZE_T n) |
| Locate byte in byte string.
|
RTI_SIZE_T | OSAPI_String_length (const char *s) |
| Return length of ASCIIZ string.
|
RTI_INT32 | OSAPI_String_cmp (const char *l, const char *r) |
| Compare two ASCIIZ strings.
|
RTI_INT32 | OSAPI_String_ncmp (const char *l, const char *r, RTI_SIZE_T num) |
| Compare two ASCIIZ strings.
|
Detailed Description
These are utilities for OS-independent memory manipulation such as filling and copying.
Function Documentation
void OSAPI_Memory_copy |
( |
void * |
dest, |
|
|
const void * |
src, |
|
|
RTI_SIZE_T |
size |
|
) |
| |
Copies size bytes from non-overlapping src to dest.
Valid dest and src >= size, where size >= 0. The src and dst memory regions should NOT overlap or the results will be undetermined. On success move size number of bytes from in [dest, dest+size) are identical to [src, src+size).
- Parameters:
-
dest | Out. Pointer to destination memory region. |
src | In. Pointer to source memory region. |
size | In. Number of bytes to copy starting at dest. |
- Exceptions:
-
- MT Safety:
- src cannot be modified concurrently; dest cannot be not modified or read concurrently.
void OSAPI_Memory_zero |
( |
void * |
mem, |
|
|
int |
size |
|
) |
| |
Sets memory region to 0.
Clear a memory region. Valid memory >= size, where size >= 0. On On success [mem, mem+size) is filled with 0.
- Parameters:
-
mem | Out. Pointer to memory region to be modified. |
size | In. Number of bytes to fill with zeroes, starting at mem. |
- Exceptions:
-
- MT Safety:
- mem cannot be modified or read concurrently.
RTI_INT32 OSAPI_Memory_compare |
( |
const void * |
left, |
|
|
const void * |
right, |
|
|
RTI_SIZE_T |
size |
|
) |
| |
Byte-wise compare of two memory regions.
This function performs a byte-wise comparison of two memory regions of size bytes. left and right must be >= 0 and size >= 0. This function does not alter any memory content.
- Parameters:
-
left | In. Pointer to logical "left" side of the inequality test. |
right | In. Pointer to logical "right" side of the inequality test. |
size | In. Number of bytes to compare, starting from left to right. |
- Returns:
- less than, equal to, or greater than 0, according to whether left is lexicographically less than, equal to, or greater than right when taken as unsigned characters.
void OSAPI_Memory_move |
( |
void * |
dest, |
|
|
const void * |
source, |
|
|
RTI_SIZE_T |
size |
|
) |
| |
Moves size bytes from non-overlapping src to dest.
Moves size bytes from non-overlapping src to dest. Valid dest and src >= size, where size >= 0. The src and dst memory regions may overlap. On success size number of bytes from right is moved to [dest, dest+size) and is identical to[src, src+size)
- Parameters:
-
dest | Out. Pointer to destination memory region. |
source | In. Pointer to source memory region. |
size | In. Number of bytes to copy starting at dest. |
- Exceptions:
-
- MT Safety:
- src cannot be modified concurrently; dest cannot be not modified or read concurrently.
void* OSAPI_Memory_fndchr |
( |
const void * |
s, |
|
|
RTI_INT32 |
c, |
|
|
RTI_SIZE_T |
n |
|
) |
| |
Locate byte in byte string.
Locate byte in byte string
- Parameters:
-
[in] | s | - Pointer to beginning of byte string |
[in] | c | - Byte to search for |
[in] | n | - Maximum search length |
- Returns:
- pointer to first occurence of c if found, NULL otherwise.
RTI_SIZE_T OSAPI_String_length |
( |
const char * |
s | ) |
|
Return length of ASCIIZ string.
Return length of ASCIIZ string not including \0
- Parameters:
-
[in] | s | - Pointer to beginning of byte string |
- Returns:
- Length of string not including \0
RTI_INT32 OSAPI_String_cmp |
( |
const char * |
l, |
|
|
const char * |
r |
|
) |
| |
Compare two ASCIIZ strings.
Lexicographically compare the null-terminated strings l and r. The comparison is using unsigned arithmetic.
- Parameters:
-
[in] | l | - Left side string |
[in] | r | - Right side string |
- Returns:
- 0 is strings are identical, > 0 if l > s and < 0 if l < s.
RTI_INT32 OSAPI_String_ncmp |
( |
const char * |
l, |
|
|
const char * |
r, |
|
|
RTI_SIZE_T |
num |
|
) |
| |
Compare two ASCIIZ strings.
Lexicographically compare null-terminated strings l and r, including up to num characters (if the null terminator is not found before the specified number of characters has been compared). The comparison is using unsigned arithmetic.
- Parameters:
-
[in] | l | - Left side string |
[in] | r | - Right side string |
[in] | num | - Maximum number of characters to compare |
- Returns:
- 0 is strings are identical, > 0 if l > s and < 0 if l < s.