Да, это во многих вариантах.
например
void *memset16(void *m, uint16_t val, size_t count)
{
uint16_t *buf = m;
while(count--) *buf++ = val;
return m;
}
void *memset32(void *m, uint32_t val, size_t count)
{
uint32_t *buf = m;
while(count--) *buf++ = val;
return m;
}
void *memsetXX(void *m, void *val, size_t size, size_t count)
{
char *buf = m;
while(count--)
{
memcpy(buf, val, size);
buf += size;
}
return m;
}
Безопасная версия:
void *memset16safe(void *m, uint16_t val, size_t count)
{
char *buf = m;
union
{
uint8_t d8[2];
uint16_t d16;
}u16 = {.d16 = val};
while(count--)
{
*buf++ = u16.d8[0];
*buf++ = u16.d8[1];
}
return m;
}
void *memset32(void *m, uint32_t val, size_t count)
{
char *buf = m;
union
{
uint8_t d8[4];
uint32_t d32;
}u32 = {.d32 = val};
while(count--)
{
*buf++ = u32.d8[0];
*buf++ = u32.d8[1];
*buf++ = u32.d8[2];
*buf++ = u32.d8[3];
}
return m;
}