perf cs-etm: Refactor enumeration cs_etm_sample_type
[linux/fpc-iii.git] / arch / csky / abiv1 / memset.c
blobb4aa75b99c5d1008bacc5fa19cc299f7954b6cbd
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #include <linux/types.h>
6 void *memset(void *dest, int c, size_t l)
8 char *d = dest;
9 int ch = c & 0xff;
10 int tmp = (ch | ch << 8 | ch << 16 | ch << 24);
12 while (((uintptr_t)d & 0x3) && l--)
13 *d++ = ch;
15 while (l >= 16) {
16 *(((u32 *)d)) = tmp;
17 *(((u32 *)d)+1) = tmp;
18 *(((u32 *)d)+2) = tmp;
19 *(((u32 *)d)+3) = tmp;
20 l -= 16;
21 d += 16;
24 while (l > 3) {
25 *(((u32 *)d)) = tmp;
26 l -= 4;
27 d += 4;
30 while (l) {
31 *d = ch;
32 l--;
33 d++;
36 return dest;