Routines for manipulation of memory blocks
See also: alloc.h
void *_memset (void *buffer, short c, unsigned long num); |
Sets num bytes of buffer to byte c.
_memset is a slower (byte-by-byte) variant of memset.
void *memchr (const void *str, short c, unsigned long len); |
Searches the first len bytes of array str for character c.
memchr searches the first len bytes of the block pointed to by str for character c. On success, memchr returns a pointer to the first occurrence of c in str. Otherwise, it returns NULL.
short memcmp (const void *s1, const void *s2, unsigned long len); |
Compares two blocks of signed chars.
memcmp compares the first len bytes of the blocks s1 and s2 as signed chars. Since it compares bytes as signed chars, memcmp returns a value
< 0 if s1 is less than s2
=0 if s1 is the same as s2
> 0 if s1 is greater than s2
For example, memcmp("\xFF","\x7F",1)
returns a value greater than 0. More precisely,
the exact return value is the result of subtracting the first pair of values
that differ in the two blocks being compared based on them being signed
chars.
Note: This routine is declared as "short" although the ANSI standard proposes "long". This is important,
because the TIOS memcmp routine puts garbage in the higher half of the d0 register.
See also: memucmp
void *memcpy (void *dest, const void *src, unsigned long len); |
Copies a block of len bytes from src to dest.
memcpy copies a block of len bytes from src to dest. If src and dest overlap, the memcpy is ill-behaved (in such case, use memmove instead). memcpy returns dest.
void *memmove (void *dest, const void *src, unsigned long len); |
Copies a block of len bytes from src to dest, with possibility of overlaping of source and destination block.
memmove copies a block of len bytes from src to dest. Even when the source and destination blocks overlap, bytes in the overlapping locations are copied correctly (in opposite to memcpy). memmove returns dest.
void *memset (void *buffer, short c, unsigned long num); |
Sets num bytes of buffer to byte c.
memset sets the first num bytes of the array buffer to the character c. memset is faster than _memset, because it sets a memory in a 4-byte chunks as long as possible. memset returns buffer.
short memucmp (const void *s1, const void *s1, unsigned long len); |
Compares two blocks of unsigned chars.
memucmp acts like memcmp, but treats s1 and s2 as pointers to unsigned chars.
See also: memcmp