Skip to content
Snippets Groups Projects
Commit ef30871f authored by Armin Luntzer's avatar Armin Luntzer
Browse files

add memset32(), memset16()

parent cc46c359
Branches
No related tags found
No related merge requests found
...@@ -29,6 +29,9 @@ void *memcpy(void *dest, const void *src, size_t n); ...@@ -29,6 +29,9 @@ void *memcpy(void *dest, const void *src, size_t n);
char *strcpy(char *dest, const char *src); char *strcpy(char *dest, const char *src);
void bzero(void *s, size_t n); void bzero(void *s, size_t n);
void *memset16(void *s, uint16_t c, size_t n);
void *memset32(void *s, uint32_t c, size_t n);
int isdigit(int c); int isdigit(int c);
int isspace(int c); int isspace(int c);
int isalpha(int c); int isalpha(int c);
......
...@@ -158,6 +158,7 @@ char *strdup(const char *s) ...@@ -158,6 +158,7 @@ char *strdup(const char *s)
char *dup; char *dup;
if (!s) if (!s)
return NULL; return NULL;
...@@ -583,7 +584,7 @@ EXPORT_SYMBOL(atoi); ...@@ -583,7 +584,7 @@ EXPORT_SYMBOL(atoi);
/** /**
* @brief fills a memory area with with the constant byte c * @brief fills a memory area with the constant byte c
* *
* @param s a pointer to the memory area * @param s a pointer to the memory area
* @param c the byte to set * @param c the byte to set
...@@ -604,6 +605,49 @@ void *memset(void *s, int c, size_t n) ...@@ -604,6 +605,49 @@ void *memset(void *s, int c, size_t n)
EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memset);
/**
* @brief fills a memory area with the constant uint16_t c
*
* @param s a pointer to the memory area
* @param c the uint16_t to set
* @param n the number of uint16_t elements to fill
*
* @returns a pointer to the memory area s
*/
void *memset16(void *s, uint16_t c, size_t n)
{
uint16_t *p = s;
while (n--)
*p++ = c;
return s;
}
EXPORT_SYMBOL(memset16);
/**
* @brief fills a memory area with the constant uint32_t c
*
* @param s a pointer to the memory area
* @param c the uint32_t to set
* @param n the number of uint32_t elements to fill
*
* @returns a pointer to the memory area s
*/
void *memset32(void *s, uint32_t c, size_t n)
{
uint32_t *p = s;
while (n--)
*p++ = c;
return s;
}
EXPORT_SYMBOL(memset32);
/** /**
* @brief convert a string to a long integer * @brief convert a string to a long integer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment