diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-26 02:51:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-26 02:51:17 +0000 |
commit | 54e0a54d94c67a2d6b74e0a491920b56e1d23223 (patch) | |
tree | ecf0b9e3eed8704d6332bf276e285494c73cb104 /include/libc-string_i386.h | |
parent | 319a4ec3bf2d9306ff885f20da8e113b015c81f6 (diff) | |
download | uClibc-alpine-54e0a54d94c67a2d6b74e0a491920b56e1d23223.tar.bz2 uClibc-alpine-54e0a54d94c67a2d6b74e0a491920b56e1d23223.tar.xz |
include/libc-string_i386.h: fix a bug where memset('\xff') misbehaves
Rules.mak: add -funsigned-char, to forestall future PITA
Diffstat (limited to 'include/libc-string_i386.h')
-rw-r--r-- | include/libc-string_i386.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/libc-string_i386.h b/include/libc-string_i386.h index 3ed9c8783..3eefdeb76 100644 --- a/include/libc-string_i386.h +++ b/include/libc-string_i386.h @@ -26,7 +26,9 @@ void *inlined_memset_const_c_count4(void *s, unsigned eax, unsigned count) return s; } - eax *= 0x01010101; /* done at compile time */ + /* You wonder why & 0xff is needed? Try memset(p, '\xff', size). + * If char is signed, '\xff' == -1! */ + eax = (eax & 0xff) * 0x01010101; /* done at compile time */ if (count == 2) { *(short *)(s + 0) = eax; |