diff options
Diffstat (limited to 'newlib/libc/string/memset.c')
-rw-r--r-- | newlib/libc/string/memset.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index ac3590ea4..a5890c884 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -59,26 +59,26 @@ _DEFUN (memset, (m, c, n), int i; unsigned long buffer; unsigned long *aligned_addr; - unsigned int d = c & 0xff; /* To avoid sign extension, copy C to an - unsigned variable. */ if (!TOO_SMALL (n) && !UNALIGNED (m)) { /* If we get this far, we know that n is large and m is word-aligned. */ + aligned_addr = (unsigned long*)m; - /* Store D into each char sized location in BUFFER so that + /* Store C into each char sized location in BUFFER so that we can set large blocks quickly. */ + c &= 0xff; if (LBLOCKSIZE == 4) { - buffer = (d << 8) | d; + buffer = (c << 8) | c; buffer |= (buffer << 16); } else { buffer = 0; for (i = 0; i < LBLOCKSIZE; i++) - buffer = (buffer << 8) | d; + buffer = (buffer << 8) | c; } while (n >= LBLOCKSIZE*4) @@ -101,7 +101,7 @@ _DEFUN (memset, (m, c, n), while (n--) { - *s++ = (char)d; + *s++ = (char)c; } return m; |